HELLO WORLD--一起加油(🍺)!|

kingwzun

园龄:3年6个月粉丝:111关注:0

8-1 文件编程7-1 - python文件基础

记得更换文件地址

f=open("F:\\vsnode\\python\\example.txt","r+")
str=f.read()
f.close()
ans=[]
for i in str:
if i.isupper():
ans.append(i.lower())
if i.islower():
ans.append(i.upper())
print(str)
ans_str="".join(ans)
print(ans_str)
f=open("F:\\vsnode\\python\\result.txt","r+")
f.write(ans_str)
f.close()

本文作者:kingwzun

本文链接:https://www.cnblogs.com/kingwz/p/16337975.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   kingwzun  阅读(86)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起