随笔分类 -  python

摘要:if not os.path.exists(path): oldmask = os.umask(000) os.makedirs(path, mode=0o777) os.umask(oldmask) 阅读全文
posted @ 2022-08-03 15:33 凯尔哥 阅读(383) 评论(0) 推荐(0)
摘要:import requests url = "http://ip:port/path" files = [("images", open("a.png", "rb")), ("images", open("b.png", "rb")), ("images", open("c.jpg", "rb")) 阅读全文
posted @ 2022-07-26 14:07 凯尔哥 阅读(154) 评论(0) 推荐(0)
摘要:python脚本 from enum import Enum # 定义状态的枚举 class State(Enum): CODE = 0 # 代码 SLASH = 1 # 斜杠 NOTE_MULTILINE = 2 # 多行注释 NOTE_MULTILINE_STAR = 3 # 多行注释遇到* N 阅读全文
posted @ 2021-09-15 10:00 凯尔哥 阅读(764) 评论(0) 推荐(0)
摘要:删除脚本 from enum import Enum # 定义状态的枚举 class State(Enum): CODE = 0 # 代码 SLASH = 1 # 斜杠 NOTE_MULTILINE = 2 # 多行注释 NOTE_SINGLELINE = 3 # 单行注释 BACKSLASH = 阅读全文
posted @ 2021-09-14 14:46 凯尔哥 阅读(1136) 评论(0) 推荐(1)
摘要:1. 先通过open函数指定编码格式,代码如下: f1= open('/path/name','r', encoding='UTF-8') # 或者 f1= open('/path/name','r', encoding='GBK') 2. 在使用上述方法都还报错的时候,可以使用如下方法: def 阅读全文
posted @ 2020-10-21 16:56 凯尔哥 阅读(2823) 评论(0) 推荐(0)
摘要:### 按照正常修改字典的逻辑修改字典,代码如下: ```python import multiprocessing multi_dict = multiprocessing.Manager().dict() multi_dict.update({"dev1": {"app1": [11], "ap 阅读全文
posted @ 2020-09-06 11:14 凯尔哥 阅读(3824) 评论(1) 推荐(0)