码迷,mamicode.com
首页 > 其他好文 > 详细

文件读删除空格

时间:2017-09-11 12:25:00      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:strip   nbsp   log   for   style   strip()   字符   with open   移除   

1 with open(shell,r+) as f:
2     for index,i in enumerate(f):
3         print(index,i.strip())  #Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)。

 

文件读删除空格

标签:strip   nbsp   log   for   style   strip()   字符   with open   移除   

原文地址:http://www.cnblogs.com/aiaiduo/p/7504225.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!