首页 > 其他 > 详细

文件读写

时间:2017-12-23 22:35:58      阅读:209      评论:0      收藏:0      [点我收藏+]

1 txt 读写

A txt读

1 def rfile():
2     f = open(**.txt,r,encoding=UTF-8)   # 中文读加编码格式
3     word_list = list(f.readlines())
4     for i in range(len(word_list)):       
5         word_list[i] = word_list[i].strip()   # 去掉读取的换行,空格
6     return word_list

B txt写

1 def wfile(word):
2     f = open(**.txt,w)
3     f.writelines(word)
4     f.close()

2 excel读写

文件读写

原文:http://www.cnblogs.com/ling-yan/p/8094572.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!