猫史档案馆


【Python作品分享】【17】光速搬运工-练习包-空白【作业帖】

用户:釜山网瘾少年釜山网瘾少年查看:0 回复:0 评论:0 创建时间:2021-05-22T20:31:48


【作品展示】

center_image

 

【作品介绍】

gyvbvvf

 

【作品源代码】

'''光速搬运工-练习包'''

# # 实践1
# # 只读打开文本
# f = open('学习日记.txt', 'r')
# # 只读打开二进制
# f = open('房子.png', 'rb')
# # (覆盖)写入模式打开二进制
# f = open('房子.png', 'wb')
# # 追加写入文本
# d = open('学习日记.txt', 'a')

# # 实践2
# f = open('自传.txt', 'w')
# f.write('我在学校篮球队当后卫')
# f.close()

# f = open('自传.txt', 'r')
# t = f.read()
# print(t)

# #改造 with open
# with open('自传.txt', 'w') as f :
#     f.write('我在学校篮球队当后卫')

# with open('自传.txt', 'r')
#     t = f.read()
#     print(t)


'''复制图片,房子.png'''
#先读
with open('房子.png', 'rb') as f:
    t = f.read()

#后写  房子副本.png
with open('房子副本.png', 'wb') as f:
    f.write(t)

















 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页