码迷,mamicode.com
首页 > 其他好文 > 详细

文件操作

时间:2018-05-28 17:24:13      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:dso   操作   read   man   mod   col   技术   图片   str   

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‘

技术分享图片

文件操作

标签:dso   操作   read   man   mod   col   技术   图片   str   

原文地址:https://www.cnblogs.com/FBYi/p/9101054.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!