
Python
疾风jf
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ModuleNotFoundError: No Module named “DBUtils“
注意 DBUtils 的版本 2.0 版本的写法:from dbutils.pooled_db import PooledDB 1.3 版本的写法:from DBUtils.PooledDB import PooledDB 重新安装2.0 版本 pip install dbutils2.0 重新安装1.3 版本 pip install dbutils1.3 显示当前dbutils版本:pip show dbutils ...原创 2022-04-04 13:24:17 · 1058 阅读 · 0 评论 -
Python 爬取公众号文章链接并生成html
微信不提供公众号分组管理,部分公众号内容优质但更新频率低,我们通过抓取特定公众号更新解决这个问题。 网上介绍的方法较多,参考各位大神的文章后,最后选择了通过公众号管理平台抓取的方法。 大体思路: 通过公众号管理平台对文章名称、更新时间、文章链接等信息进行抓取; 结果存入mysql数据库备用; 读取mysql数据生成html,通过flask提供web服务供局域网内浏览器使用。 其中,参数中的 cookie、token 需在抓取前手动更新;fakeid 需手工获取一次即可。 步骤如下: 1准备: 注册公众号原创 2022-03-24 17:44:19 · 4378 阅读 · 3 评论 -
Python基础:dict、tuple、list;dict 和 json 转换
dict:字典;带字段名; tuple:元组;列表值不可变; list:列表;列表值可变; Example: dict1={ 'name':'tom', 'sex': 'm', 'age':18, } tuple1=['tom','m',18] list1=['tom','m',18] print(dict1['name'],dict1['sex'],dict1['age']) print(tuple1[0],tuple1[1],tuple1[2]) print(list1[0]原创 2022-03-24 12:00:40 · 2277 阅读 · 0 评论 -
Python-MySQL:数据库的连接
import pymysql from dbutils.pooled_db import PooledDB POOL = PooledDB( creator=pymysql, # 使用链接数据库的模块 host='127.0.0.1', port=3306, user='root', password='footba', database='testdb', # charset='utf8' ) def listarticle():原创 2022-03-24 11:47:55 · 1808 阅读 · 0 评论 -
Python基础:函数 input、eval
Example1: x=input('x=') y1=x y2=eval(x) y3=eval(x*3) y4=eval(x)*0.3 print(y1,type(y1)) print(y2,type(y2)) print(y3,type(y3)) print(y4,type(y4)) Output: x=5 5 <class 'str'> 5 <class 'int'> 555 <class 'int'> 1.5 <class 'float'> inp原创 2022-03-23 15:34:19 · 1413 阅读 · 0 评论