Python剑谱
以Python为剑,刻写代码
小黄鸭会飞呀
这个作者很懒,什么都没留下…
展开
-
Python-虚拟环境的搭建和连接云服务器(完整流程)
1.更新源sudo apt-get update2.查看是否安装pippip3.安装pipsudo apt install python3-pip4.安装虚拟环境pip install virtualenvpip install virtualenvwrapper5.创建文件夹mkdir .virtualenvs6.查看virtualenvwrapper.sh位置find ...原创 2020-03-18 01:11:47 · 821 阅读 · 0 评论 -
Python-第三方库的国内源
豆瓣 https://pypi.doubanio.com/simple原创 2020-05-08 16:38:30 · 1051 阅读 · 0 评论 -
Python-哈希摘要代码
字段哈希代码from hashlib import md5hasher = md5('123456'.encode())hasher.hexdigest()文件哈希代码from hashlib import md5with open('xxxx.exe', 'rb') as file: //生成迭代器 file_iter = iter(lambda: file.read(512), b'') //生成哈希 for data in file_iter: hasher.update(d原创 2020-05-17 13:48:20 · 105 阅读 · 0 评论 -
Python安装、导出环境依赖
导出:pip freeze > requirements.txt安装:pip install -r requirements.txt原创 2021-04-28 09:25:47 · 71 阅读 · 0 评论 -
Python-Json
dumpjson.dump() ->用于将dict类型转成str,并写入json文件loadjson.load() -> 用于从json文件中读取数据dumpsjson.dumps() -> 用于将dict转成strloadsjson.loads() -> 用于将str类型转成dict原创 2021-01-25 13:34:03 · 64 阅读 · 1 评论 -
Python-yaml
yaml.load(stream, Loader=yaml.FullLoader)作用:直接将字典转为json格式原创 2020-12-16 15:46:00 · 196 阅读 · 0 评论 -
Python-正则表达式
re.match(pattern, string, flags)作用:只匹配字符串的开始部分pattern:正则表达式,匹配成功返回Match,否则返回Nonestring:字符串flags:匹配方式,如:区分大小写等re.search(pattern, string, flags)作用:匹配整个字符串参数与re.match一样re.sub(pattern, repl, string, count)作用:替换匹配到的字符串repl:替换的字符count:替换个数..原创 2020-12-16 15:21:09 · 36 阅读 · 0 评论 -
Python-docx
读取wordimport docxfile = docx.Document('文件')for para in file.paragraphs: print(para.text)原创 2020-12-24 13:05:34 · 112 阅读 · 0 评论 -
Python-win32com
用于doc转docxfrom win32com import clientdef doc_to_docx(file): # 打开word应用程序 word = client.Dispatch("Word.Application") # 打开word文件 doc = word.Documents.Open(file) # 另存为后缀为".docx"的文件,其中参数12指docx文件 doc.SaveAs("{}x".format(file), 12)原创 2020-12-24 12:18:28 · 110 阅读 · 0 评论