python
valueflow
记录学习过程。
展开
-
KeyError: ‘formatters‘ [2508] Failed to execute script
KeyError: 'formatters' [2508] Failed to execute script原创 2022-08-17 15:06:04 · 462 阅读 · 0 评论 -
NS_BINDING_ABORTED
在window防火墙的高级设置入站规则中,找到对应的程序,允许连接即可。粗暴一点的话,直接把防火墙关了。原创 2022-07-10 13:01:09 · 1550 阅读 · 0 评论 -
python requests socks
import requestsproxies = { 'http': 'socks5://127.0.0.1:1080', 'https': 'socks5://127.0.0.1:1080'}r=requests.get('https://www.google.com', proxies=proxies)print(r.status_code)原创 2021-08-23 22:51:48 · 215 阅读 · 0 评论 -
ConfigParser.MissingSectionHeaderError: File contains no section headers.
报错将 utf-8 改为utf-8-sigdef get_config(filepath: str) -> dict: config = configparser.ConfigParser() # uft-8 不需要BOM # "utf-8-sig"读取带有BOM的"utf-8文件 config.read(filepath, encoding='utf-8-sig') items = config._sections items = dict(ite原创 2021-08-22 19:08:05 · 3759 阅读 · 0 评论 -
telegram消息提醒BOT简单使用流程
创建消息提醒机器人进入Telegram APP找到@BotFather输入/start接下来根据英文提示创建自己的Bot1.查找chat_idGET https://api.telegram.org/{botkey}/getUpdates2.安装python版本的telegramAPIpip install python-telegram-bot3.发送信息import telegramdef main(): # 代理请求 proxy = telegram.utils.req原创 2021-07-28 23:30:19 · 4863 阅读 · 0 评论 -
构建自己的python库
封装自己的库,文件夹需按以下格式├── LICENSE ├── README.md ├── packageName│ ├── __init__.py │ ├── hello.py │ ├── word.py ├── setup.pysetup.pyfrom setuptools import setupsetup( name='example_package', version='0.0.1', packages=['packageName'], i原创 2021-07-16 22:19:04 · 180 阅读 · 0 评论 -
python配置文件中存储字典(键值对)
yml 文件配置方式DEFAULT: ADMIN: PERSON MESSAGE: 'name': 'hello' 'age': 20python读取配置信息import yamlwith open('config.yml') as f: config = yaml.load(f, Loader=yaml.FullLoader) content = config['DEFAULT']['MESSAGE'] print(co原创 2021-06-20 16:39:18 · 497 阅读 · 0 评论 -
python打包exe报错:IndexError: tuple index out of range
因为pyinstaller不支持python3.5以上版本,如果不回退版本,可以卸载原有安装包,按下方指令重新安装。pip uninstall pyinstallerpip install https://github.com/pyinstaller/pyinstaller/tarball/develop编译成可执行文件(.exe)pyinstaller -F hello.py...原创 2021-06-20 15:20:04 · 1096 阅读 · 0 评论 -
linux上安装python其他版本
打开终端输入sudoapt-get -q updatesudo apt-get install -ypython3.7sudo apt-get insatll -ypython3.7-distutils打开https://bootstrap.pypa.io/get-pip.py下载到本地终端进入下载文件所在路径,输入:sudo python3 get-pip.py完成!...原创 2020-12-16 16:12:01 · 86 阅读 · 0 评论 -
python中np.random.choice()的使用方法
官方予以的文档说明:numpy.random.choice(a, size=None, replace=True, p=None)a:输入的如果是一维数组,则从该一维数组中采样,如果是int型,则从0到a-1序列随即采样。size: 表示采样的数量;可以是int型(默认为1)也可以是tuple。如果是tuple,例如(m,n,k),则采样数为mnk,大小为(m,n,k)的数组。repla...原创 2020-02-21 23:39:41 · 4284 阅读 · 0 评论 -
虚拟环境virtualenv以及virtualenvwrapper的配置
本人系统环境用的是Linux(Ubuntu)virtualenv前提提要:使用Python开发项目时,遇到需要使用不同软件版本的项目时,Virtualenv能创建独立的Python虚拟环境工具,建立多个相互独立,互不影响的Python工作环境。安装打开终端pip3 install virtualenvvirtualenv空格xxx(项目名称)启动:进入虚拟环境的bin目录下,输入s...原创 2019-10-23 22:48:41 · 339 阅读 · 0 评论