python学习

1、基础

1、jupyter notebook安装第三方包:!pip install pyquery
超时问题:
在这里插入图片描述pip install jieba –index https://pypi.mirrors.ustc.edu.cn/simple/
2、图表正常显示汉字:

from matplotlib import font_manager
my_font = font_manager.FontProperties(family='SimHei', size=15)
my_font1 = font_manager.FontProperties(family='SimHei', size=10)
fig,ax = plt.subplots(figsize=(8,6))
plt.bar(x,y)
plt.title("每个市辖区的烤匠店铺数量",fontproperties=my_font)
plt.ylabel("烤匠店铺数量",fontproperties=my_font1)
plt.show()

3、list
list.append()
if list:如果list不为空
将list转为DataFrame:

https://blog.csdn.net/senwen616/article/details/82662093

2、爬虫

1、html.status_code 200代表服务器正常响应 404代表页面未找到
2、res = requests.get(url,headers=headers)  向网站发起请求,并获取响应对象
doc=res.text
doc(“div.reviews-items > ul > li”).items() 返回节点的生成器generator object PyQuery.items

3、报错

1、报错 XXX is not callable时,是因为代码调用了一个不能被调用的变量或对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值