随笔分类 -  python

摘要:str=str2.encode(encoding='unicode_escape') #ansi ,GBK,gb2312,utf-8,utf-16,ascii,unicode_escape 阅读全文 »
posted @ 2023-01-31 18:11 只为。 阅读(15) 评论(0) 推荐(0) 编辑
摘要:一、连接redis 连接redis的方式,我们通常选择连接池。 import redis pool = redis.ConnectionPool(host='127.0.0.1',port=6379,password='12345') r = redis.Redis(connection_pool= 阅读全文 »
posted @ 2023-01-20 11:00 只为。 阅读(163) 评论(0) 推荐(0) 编辑
摘要:requirements.txt用于python项目的第三方包导入,里面记录了项目所的依赖包和精确地版本号。 一、生成requirements.txt文件 pip freeze >requirements.txt 二、执行requirements.txt文件 pip install - r requ 阅读全文 »
posted @ 2022-12-01 11:03 只为。 阅读(143) 评论(0) 推荐(0) 编辑
摘要:一、单个设置下载源 每次下载包时,都需要在结尾加上这段命令 在命令结尾加上:-i http://pypi.doubanio.com/simple --trusted-host pypi.doubanio.com 如: pip install pytest -i http://pypi.doubani 阅读全文 »
posted @ 2022-11-29 11:12 只为。 阅读(1305) 评论(0) 推荐(0) 编辑
摘要:一、闭包 了解装饰器前,首先要了解,什么是闭包。 闭包就是在一个函数中再定义一个函数,内部函数需要引用外部函数的参数,且外部函数的返回值是内部函数。 def outside(x): def inside(y): return x + y return inside print(outside(1)( 阅读全文 »
posted @ 2022-09-22 15:28 只为。 阅读(71) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示