作业8
fr = open('fjq.txt',mode='r',encoding='utf-8') fjq = fr.read() print('明文:'+ljy) print('密文:',end='') fw = open('cipherText.txt',mode='a',encoding='utf-8') for c in fjq: print(chr(ord(c)+3),end='') fw.write(chr(ord(c)+3)) fr.close() fw.close()
fjq = open('plainText.txt',mode='r', encoding='utf-8') plainText = fjq.read() print('明文:'+plainText) print('密文:',end='') for c in plainText: print(chr(ord(c)+3),end='') for c in plainText: print(chr(ord(c)+3),end='')