python 讀取文本文件python讀取文本?Python File object provides various ways to read a text file. The popular way is to use the readlines() method that returns a list of all the lines in the file. However, it’s not suitable to read a large text file becau
復制代碼 代碼如下:
import os
import codecs
filenames=os.listdir(os.getcwd())
python處理excel數據、out=file("name.txt","w")
for filename in filenames:
out.write(filename.decode("gb2312").encode("utf-8"))
out.close()