来来去去
分类: Python/Ruby
2010-01-18 18:57:56
import string def translate(): intab='abcdefghijklmnopqrstuvwxyz' outtab='cdefghijklmnopqrstuvwxyzab' transtab=string.maketrans(intab,outtab) f=open("E:\\python challenge\\message.txt","r") str=f.read() outStr=string.translate(str,transtab) f2=open("E:\\python challenge\\trans.txt","w") f2.write(outStr) f.close() f2.close() if __name__=='__main__': translate() |