文件读删除空格

1 with open('shell','r+') as f:
2     for index,i in enumerate(f):
3         print(index,i.strip())  #Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)。
原文地址:https://www.cnblogs.com/aiaiduo/p/7504225.html