with open('Zen of Python.txt','r') as fp:
date=fp.readlines()
print(date)#若不想显示出来,可将print语句删除
result=[str.swapcase() for str in date]
print(result)#若不想显示出来,可将print语句删除
with open('convert.txt','w') as fp:
fp.writelines(result)
['The Zen of Python, by Tim Pet