注:部分内容来自书籍或者网络,如有侵权,请联系删除。
方法一
with open('data.txt') as inf,open('out.txt','w') as outf:
for line in inf:
outf.write(" ".join([word.capitalize() for word in line.split()]))
方法二
with open('data.txt') as inf,open('out.txt','w') as outf:
for line in inf:
print(*[word.capitalize() for word in line.split()],file=outf)
「 文章如果对你有帮助,请点个赞哦^^ 」 
0
若无特殊注明,文章均为本站原创或整理发布。
转载请注明本文地址:https://om.fangxiaoxiong.com/2712.html