上一页 1 2 3 4 5 6 7 ··· 10 下一页

2023年3月10日

追加内容

摘要: """@作者: 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 想起就不爽 阅读(7) 评论(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 想起就不爽 阅读(14) 评论(0) 推荐(0) 编辑

03 函数基本使用

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

posted @ 2023-03-10 17:50 想起就不爽 阅读(15) 评论(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 想起就不爽 阅读(180) 评论(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 想起就不爽 阅读(3) 评论(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 想起就不爽 阅读(9) 评论(0) 推荐(0) 编辑

04 文件的高级操作:控制文件指针的移动

摘要: """@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128"""# 指针移动的单位都是以bytes/字节为单位# 只有一种情况特殊:# t模式下的read(n),n代表的是字符个数# with 阅读全文

posted @ 2023-03-10 17:47 想起就不爽 阅读(18) 评论(0) 推荐(0) 编辑

03 文件的操作的其他方法

摘要: """@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128"""# 一:读相关操作# 1、readline:一次读一行# with open(r'g.txt',mode='rt',encodin 阅读全文

posted @ 2023-03-10 17:46 想起就不爽 阅读(11) 评论(0) 推荐(0) 编辑

02 b模式

摘要: """@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128控制文件读写内容的模式t: 1、读写都是以字符串(unicode)为单位 2、只能针对文本文件 3、必须指定字符编码,即必须指定enco 阅读全文

posted @ 2023-03-10 17:46 想起就不爽 阅读(20) 评论(0) 推荐(0) 编辑

01 x模式

摘要: """@作者: egon老湿@微信:18611453110@专栏: https://zhuanlan.zhihu.com/c_1189883314197168128x模式(控制文件操作的模式)-》了解 x, 只写模式【不可读;不存在则创建,存在则报错】"""# with open('a.txt',m 阅读全文

posted @ 2023-03-10 17:45 想起就不爽 阅读(26) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 10 下一页

导航