码迷,mamicode.com
首页 > 编程语言 > 详细

python 给文件批量加‘“’ ”,"

时间:2015-09-29 20:30:04      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

file  = open(face.txt,r)
filew = open(face1.txt,w)    
try:
    for line in file:
        print(line)
        if line.strip() !=‘‘:
            line = "+line.strip()+"+",\n"    // 去掉空格、换行符 加上引号 逗号 换行符
            filew.write(line)
finally:
    file.close()
    filew.close()

 

python 给文件批量加‘“’ ”,"

标签:

原文地址:http://www.cnblogs.com/lipeil/p/4847166.html

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