随笔分类 - python
摘要: 使用到的知识点:os模块执行linux指令、json.dump()、with open as f 代码实现 import sys import os import json # 向json文件file中添加内容data,其中data的类型为字典 def write_json(file, data
阅读全文
摘要:1、三种常见的字典遍历实现 def get_key_value(dics): '''遍历所有键值对''' for key, value in dics.items(): print(f"{key}: {value}") def get_keys(dics): ''' 遍历所有的键''' for ke
阅读全文
摘要:移动并重命名工作簿 1 from pathlib import Path # 导入pathlib模块的path类 2 import time 3 4 # Press the green button in the gutter to run the script. 5 if __name__ ==
阅读全文