创建example.txt,编写程序只将大小写字母转换,其余不变动。

CSDN问答 2021-12-30 13:49:24 阅读数:888

创建 txt example 编写程序 example.txt

img




采纳答案:
with open(filename) as f: con=f.read().swapcase()with open(filename,'w') as f1: f1.write(con)


其他答案2:
with open('example.txt','r') as f: ff = f.read().swapcase() f.close()f1=open("result.txt","w")f1.write(ff)f1.close()

img


其他答案3:

要找到路径

版权声明:本文为[CSDN问答]所创,转载请带上原文链接,感谢。 https://ask.csdn.net/questions/7613057