摘要: 一、删除文件和目录 Python 中利用 os 模块对文件进行操作。 import os path = r'C:\Users\111\Desktop\test' os.chdir(path) os.listdir() file_path = os.path.join(path, '我.txt') # 阅读全文
posted @ 2022-08-08 15:42 Hider1214 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 日常工作中常常需要打印日志,进行查看、调试,有时打印日志很长而长度不一致的话,查阅起来难免没那么直观,遂诞生寻找控制打印长度的函数。例如:ljust、rjust、center等。 一、ljust、rjust、center方法 这3个方法都可以设定对齐长度,填充特定字符。 语法 String.ljus 阅读全文
posted @ 2022-08-08 13:04 Hider1214 阅读(665) 评论(0) 推荐(0) 编辑