文件操作 - file_progress.py
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/doc/python3-rich/examples/file_progress.py
编辑文件内容
from time import sleep from urllib.request import urlopen from rich.progress import wrap_file # Read a URL with urlopen response = urlopen("https://www.textualize.io") # Get the size from the headers size = int(response.headers["Content-Length"]) # Wrap the response so that it update progress with wrap_file(response, size) as file: for line in file: print(line.decode("utf-8"), end="") sleep(0.1)
修改文件时间
将文件时间修改为当前时间的前一年
删除文件