随笔分类 -  python / 学习代码笔记 / day13

追加内容
摘要:"""@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128""" with open('access.log', mode='at', encoding='utf-8') as f: f.wri 阅读全文

posted @ 2023-03-10 17:52 小小小传说 阅读(19) 评论(0) 推荐(0)

复习
摘要:"""@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128"""with open('a.txt', mode='rt', encoding='utf-8') as f: for line in 阅读全文

posted @ 2023-03-10 17:51 小小小传说 阅读(34) 评论(0) 推荐(0)

03 函数基本使用
摘要:"""@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128 1、什么是函数 函数就相当于具备某一功能的工具 函数的使用必须遵循一个原则: 先定义 后调用2、为何要用函数 1、组织结构不清晰,可读 阅读全文

posted @ 2023-03-10 17:50 小小小传说 阅读(43) 评论(0) 推荐(0)

02 文件修改的两种方式
摘要:"""@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128"""# with open('a.txt',mode='r+t',encoding='utf-8') as f:# f.seek(9, 阅读全文

posted @ 2023-03-10 17:50 小小小传说 阅读(307) 评论(0) 推荐(0)

01 f.seek的应用
摘要:"""@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128"""import timewith open('access.log', mode='rb') as f: # 1、将指针跳到文件末尾 阅读全文

posted @ 2023-03-10 17:49 小小小传说 阅读(22) 评论(0) 推荐(0)

day13笔记
摘要:上节课复习: x+ b 1、读写都是以bytes 2、针对所有文件 3、一定不能指定encoding with open('a.txt',mode='rb') as f: res=f.read() print(res) # bytes类型 res.decode('utf-8') bytes=>二进制 阅读全文

posted @ 2023-03-10 17:48 小小小传说 阅读(17) 评论(0) 推荐(0)

导航