![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
Ayu___
这个作者很懒,什么都没留下…
展开
-
python Segmentation fault: 11
用python跑一个项目时,一直出现:Segmentation fault: 11gdb:根据我的一步一步排查,一旦这句话出现在代码里,就会报错from src.utils.sort import Sort然后,神奇的地方来了,我把这句代码位置提到了第一行,错误消失了!!!!迷惑...原创 2021-03-24 13:02:06 · 1401 阅读 · 0 评论 -
迷惑事件之python列表序列化
if not os.path.exists("data/rawdata.json"): #text =[Preprocessing(line).split() for line in f] text = ['easi', 'know', 'want', 'stay'] print(type(text)) with open('data/rawdata.json', 'w') as f: json.dump(text, f原创 2021-02-19 15:39:54 · 607 阅读 · 0 评论 -
使用pip时出现Proxyerror
昨天想要导入opencv的库,就一直显示这个错误,然后我尝试了各种办法重装python、手动下载opencv的库复制进site-package都没有用!!发现是代理的问题,可能是不小心设置了代理解决方法是在系统设置中,关闭手动设置代理,打开自动检测设置:成功pip install opencv-python!!!参考:[https://blog.csdn.net/destiny_balabala/article/details/107895156]...原创 2021-01-22 10:55:35 · 760 阅读 · 0 评论 -
Python-canvas
用canvas画了一个多啦A梦(其实就是一直在调位置)它长成这样:from tkinter import *import math as mroot = Tk()w = Canvas(root, width=400, height=400, background="white")w.pack()w.create_line(0, 200, 400, 200, dash=(4, 4))w.create_line(200, 0, 200, 400, dash=(4, 4))# 头部w.c原创 2020-08-16 10:54:27 · 546 阅读 · 0 评论 -
tkinter:scroll/scale
为了在某个组件上安装滚动条,我们需要:1.设置该组件的yscrollcommand(垂直)/xscrollcommand(水平)选项为Scrollbar组件的set()方法;2.设置Scrollbal组件的command选项为该组件的yview方法。from tkinter import *root = Tk()sc = Scrollbar(root)sc.pack(side=RIGHT, fill=Y)lb = Listbox(root, yscrollcommand=sc.set)原创 2020-08-09 17:18:42 · 187 阅读 · 0 评论 -
Scrapy框架
使用Scrapy抓取网站步骤:创建一个Scrapy项目;定义Item容器;编写爬虫;存储内容。步骤详解1.在 cmd 中输入scrapy startproject projectname 创建Scrapy项目。2.Item是保存爬取到的数据的容器,使用方法类似python字典,并提供额外保护机制来避免拼写错误导致的未定义字段错误。class DmozItem(scrapy.Item): # 定义要存储字段的格式 # define the fields for your item原创 2020-08-07 17:21:16 · 104 阅读 · 0 评论 -
修改header-隐藏身份
修改header-隐藏身份 通过Request的headers参数修改// head必须是字典格式head = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'}req = urllib.request.Request(url, data,head)通过Requst.add_heade原创 2020-08-03 11:01:51 · 417 阅读 · 0 评论