Python:文件中每行开头加一个逗号‘,’

From_file=open('D:\\python\\A\\tianqi.txt')
f=open('niuniu1.txt','w')
count=0
for each_line in From_file:
    f.writelines(','+each_line)
    count+=1

f.close()
From_file.close()
print('文件中总共有:%d行'%count)

没有更多推荐了,返回首页