读书笔记
爱ZW的小白猿
这个作者很懒,什么都没留下…
展开
-
python文件/目录处理二(os模块)
1、展示当前文件夹所有文件 import os path = './' dirs = os.listdir(path) for file in dirs: print(file) 输出 1111.py dir.py exercise1.py file2.py fileprocess.py test1.txt 天气预报.py 如果想要其他文件夹内的文件,可以更改相应的绝对路径/相对路径 ...原创 2022-03-26 22:42:09 · 514 阅读 · 0 评论 -
python文件/目录处理(一)
一、文件内容读取 1、读取文件内容 pi_digits.txt文件内容如下: 3.14159526 55566656 44568965 通过python文件处理读取文件内容: with open('D:\pythontest\pi_digits.txt') as f: contents = f.read() print(contents) 输出: 3.14159526 55566656 44568965 输出打印有一行空行,在print语句中使用rstrip() with原创 2022-03-26 15:17:11 · 854 阅读 · 0 评论 -
TCP和UDP的区别
TCP和UDP的区别原创 2022-03-19 14:38:03 · 2819 阅读 · 0 评论