python
白素周期
这个作者很懒,什么都没留下…
展开
-
win11 pip.ini
win pip.ini conf原创 2023-08-31 21:49:29 · 443 阅读 · 0 评论 -
正则替换中文字符串中英文前后的空格
正则替换中文中英文前后的空格原创 2023-08-31 19:14:07 · 149 阅读 · 0 评论 -
AttributeError: Path object has no attribute joinpath
python pathlib原创 2022-04-19 15:22:26 · 877 阅读 · 0 评论 -
docker pulsar standalone tls
docker pulsar standalone tlsdocker run --name pulsar \ -p 6650:6650 \ -p 8080:8080 \ -p 6651:6651 \ -p 8443:8443 \ -v /root/pulsar/data:/pulsar/data \ -e PULSAR_PREFIX_brokerServicePortTls=6651 \ -e PULSAR_PREFIX_webServicePortTls=8443原创 2022-03-23 15:56:21 · 3714 阅读 · 0 评论 -
requests请求重定向后获取headers
requests请求重定向后,获取重定向地址的headers,cookieimport requestsresponse = requests.post(url, data, headers, verify=False)for his in response.history: print(his.headers) print(his.headers['Set-Cookie']) print(his.cookies)...原创 2020-07-09 16:12:01 · 1570 阅读 · 0 评论 -
elasticsearch-py update
es_dashed_info = ES.search(index='dashed', doc_type='adlab', q='code:"%s"' % info)dashed_info = es_dashed_info['hits']['hits'][0]['_source']res = ES.update(index='dashed', doc_type='adlab', id=inf原创 2018-02-06 14:55:26 · 210 阅读 · 0 评论 -
docker 开发 python 配置
纠结python2 or python3 , 当然是全都用了,好吧,docker 隔离,啥都不说了。debug 是个坑,基本上就 pdb 和 print 了, 默默选择了print, pdb不会用啊。 单步,远程调试,可以试试 pycharm。 如果打算用 vscode 哪就好好print吧。vscode 提供都 ptvsd 也只能单步打印,没有监控,没有变量可看,T_T.原创 2018-01-22 19:13:12 · 1218 阅读 · 0 评论 -
centos6.5 x64 minimal 安装 pdfkit
说明最近用python2.7做了个项目需要html转pdf,查了一下用到pdfkit 和 wkhtmltopdf,于是乎折腾一番安装这里是root权限# wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2/wkhtmltox-0.12.2_linux-centos6-amd64.rpm# pip27 in原创 2017-10-16 15:53:22 · 726 阅读 · 0 评论 -
wkhtmltopdf error
说明html转个pdf 一堆bug , 有一个记录一个.. python27的, 很抱歉我只找到了原因,没找到解决方案。bug执行>>> import pdfkit>>> pdfkit.from_file('aa.html', 'out.pdf')errorTraceback (most recent call last): File "<stdin>", line 1, in <modu原创 2017-10-24 11:01:46 · 7068 阅读 · 7 评论 -
wkhtmltopdf bug
遇见在 Ubuntu Server 的命令行执行python 命令 pdfkit 把HTML 转为PDF时异常:IOError: wkhtmltopdf exited with non-zero code -6. error:QXcbConnection: Could not connect to display原因问题原因不是很清楚,大概是因为没有界面显示,没有解析HTML的模块。总之少了某些依原创 2017-08-31 14:50:29 · 3449 阅读 · 0 评论 -
python flask
sha1 加密校验from werkzeug.security import check_password_hashfrom werkzeug.security import generate_password_hash-- 加密hash = generate_password_hash('12345678', method='pbkdf2:sha1', salt_length=8)-- 校验原创 2017-05-02 16:24:50 · 438 阅读 · 0 评论 -
ubuntu install MySQLdb
安装 sudo apt-get install python-dev sudo apt-get install mysql-server sudo apt-get install libmysqld-dev pip install mysql-python原创 2017-01-12 15:17:21 · 144 阅读 · 0 评论 -
Python 时间戳和日期相互转换
python 时间戳和日期相互转换有4个重要函数 time.localtime() 和 time.strptime() 都得到 struct_time time.strftime() 可以这么理解 “string format time” 格式化 time.strptime() 可以理解为 “string parser time” 反格式化 tim原创 2017-03-16 19:41:39 · 37916 阅读 · 0 评论 -
Python BeautifulSoup4
BeautifulSoup4python 解析html, 用一次翻一次文档,无语了。距离上次用BeautifulSoup4已经差不多10个月了…./(ㄒoㄒ)/~~ 现在做个记录,方便下次用。安装 pip install beautifulsoup4引入from bs4 import BeautifulSoupsoup = BeautifulSoup(html_doc, 'html.pars原创 2017-03-09 14:59:37 · 475 阅读 · 0 评论