文件操作

fr = open ('win.txt',mode='r',encoding='utf-8')
win=fr.read()
print('明文:'+ win)
print('密文:',end='')
for c in win:
    print(chr(ord(c)+3),end='')

fw = open('bili.txt',mode ='a',encoding='utf-8')
for c in win:
    print(chr(ord(c)+3,),end='')
    fw.write(chr(ord(c)+3))

fr.close()
fw.close()

name1 = 'phone'
name2 = 'ball'
superman = ['strong','handsome','tall','humorous']

print(superman[0])
print(superman[-2])
print(len(superman),superman)

superman.append('bay')
superman.insert(1,'jack')

superman.pop(0)
superman.pop(-1)

superman[0]='pig'

posted @ 2018-05-28 17:08  FBYi  阅读(107)  评论(0编辑  收藏  举报