随笔- 182
文章- 1
评论- 28
阅读-
57万
随笔分类 - Python
Python
QTablewidget嵌套QCombobox卡顿
摘要:讯飞星火给出的答案: 这种情况可能是因为在 QTableWidget 的单元格中嵌套了过多的 QComboBox 控件,导致内存占用过高,从而出现卡顿和无法弹出 QComboBox 控件的问题。 为了解决这个问题,你可以尝试以下方法: 1. 减少 QComboBox 的数量:尽量减少在每个单元格中嵌
阅读全文
sqlalchemy报错TypeError: __init__() got multiple values for argument 'schema'
摘要:使用sqlalchemy读取数据库时抛出异常 TypeError: __init__() got multiple values for argument 'schema' ①似乎SQLAlchemy的版本2.0.0(2023年1月26日发布)与pandas的早期版本不兼容。 建议升级pandas版
阅读全文
matplotlib绘图报错138: UserWarning: Glyph 8722 (\N{MINUS SIGN}) missing from current font.
摘要:解决方法 #给matplotlib指定中文字体 matplotlib.rcParams['font.family'] = 'SimHei' #正常显示坐标轴负号 matplotlib.rcParams['axes.unicode_minus'] = False
阅读全文
Python字符串转字典
摘要:1. ast包 import ast user_info = '{"name" : "南湖", "gender" : "male", "age": 28}' user_dict = ast.literal_eval(user_info)# 结果如下:来自Spdyer(python 3.7) 2. 通
阅读全文
python时间strftime格式化去除前导0
摘要:print(datetime.datetime.now().strftime("%Y-%#m-%d"));也就是%m之间多了一个# 注:在其他文章看到是说要在格式化参数和%符号之间加一个“-”符号,尝试无效。
阅读全文
Beautiful Soup 解析html表格
摘要:from bs4 import BeautifulSoup import urllib.request doc = urllib.request.urlopen('http://www.bkzy.org/Index/Declaration?intPageNo=1') doc = doc.read()
阅读全文
Python 字符串操作 starswitch() find() re.IGNORECASE replace() join()
摘要:检测开头&结尾开头:startswith()url = 'http://www.python.org' url.startswith('http') >>>True 结尾:endswith() url = 'http://www.python.org' url.endswith('org') >>>
阅读全文
python:sys.exit() os._exit() exit() quit()
摘要:1》sys.exit() >>> import sys>>> help(sys.exit)Help on built-in function exit in module sys:exit(...) exit([status]) Exit the interpreter by raising Sys
阅读全文
selenium webdriver报错 ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。
摘要:昨天跑的好好的代码,今天突然报错: ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 调查一下,原来是Chrome自动升级,而chromedriver没有更新的原因,手动更新到对应版本就好了。
阅读全文
webdriver保存验证码截图
摘要:element = wait.until ( EC.visibility_of_element_located((By.CSS_SELECTOR,'.quc-main .quc-field-captcha img'))) #等待验证码加载完毕 browser.save_screenshot('scr
阅读全文
webdriver.chrome()禁止加载图片
摘要:from selenium import webdriver chrome_options = webdriver.ChromeOptions() prefs = {"profile.managed_default_content_settings.images": 2} chrome_option
阅读全文
Requests卡死问题
摘要:https://www.cnblogs.com/niansi/p/7143736.html https://blog.csdn.net/pilipala6868/article/details/80712195 设置timeout依然卡死,据说是DNS的问题,解决方案是改成阿里公共DNS(223.5
阅读全文
requests库
摘要:还没整理,先贴俩链接。 https://www.cnblogs.com/lilinwei340/p/6417689.html http://docs.python-requests.org/zh_CN/latest/user/quickstart.html
阅读全文
HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>...))
摘要:HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection objec
阅读全文
Unable to round-trip http request to upstream: dial tcp xx.xx.xx.xx:xxxx: i/o timeou
摘要:关闭蓝灯之类的软件。
阅读全文
python selenium打开新窗口,多窗口切换
摘要:from selenium import webdriver browser=webdriver.Firefox() browser.maximize_window() browser.get('https://www.baidu.com') js='window.open("https://www
阅读全文
Python- 解决PIP下载安装速度慢
摘要:让PIP源使用国内镜像,提升下载速度和安装成功率。 国外的源下载速度太慢,而且经常出现下载后安装出错问题。把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率。 国内源: 新版ubuntu要求使用https源,要注意。 清华:https://pypi.tuna.tsinghua.
阅读全文
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
摘要:from selenium import webdriver browser = webdriver.Chrome() browser.get('http://www.baidu.com')运行报错:selenium.common.exceptions.WebDriverException: Mes
阅读全文