OpenFile = open("source.txt","r")
lines = OpenFile.readlines()
CreateFile = open("target.txt","w")
for i in lines:
Ri = i[::-1]
if lines.index(i) == -1:
break
Ri = Ri.strip()
Ri = Ri+"\n"
CreateFile.write(Ri)
OpenFile.close()
CreateFile.close()
确实如此