1 with open('shell','r+') as f: 2 for index,i in enumerate(f): 3 print(index,i.strip()) #Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)。
posted on 2017-09-11 11:37 aiaiduo 阅读(120) 评论(0) 编辑 收藏 举报