会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
break大蜗牛
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
下一页
2018年7月15日
[python3 - Basic] Dict
摘要: 1. 初始化字典 testDict = dict() 2. 赋值 testDict[key] = value 3. 判断是否存在key if key in testDict
阅读全文
posted @ 2018-07-15 16:31 break大蜗牛
阅读(186)
评论(0)
推荐(0)
2018年5月27日
[python3 - TroubleShooting] UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 27: illegal multibyte sequence
摘要: 问题: cmd里直接print的时候报错 之前已经测试了一个页面,编码没有问题。这是在爬类似页面的时候报的错 思路: 因为这个看上去不是整体的编码问题,所以我直接查看了报错的字符编码'\xa0',发现这个是unicode下的'&nbps',而这个编码不存在于gbk里 尝试: replace(u'\x
阅读全文
posted @ 2018-05-27 07:43 break大蜗牛
阅读(216)
评论(0)
推荐(0)
2018年5月22日
[python3 - package] lxml
摘要: 1. 安装 pip install lxml 2. 官方文档 http://lxml.de/ 3. 常用类 - Element 将request.get()返回的html转换为Element 4. 常用方法 Element.xpath() 返回Element类 可以精确定位到想要的node 如果匹配
阅读全文
posted @ 2018-05-22 07:07 break大蜗牛
阅读(123)
评论(0)
推荐(0)
2018年5月16日
[python3 - TroubleShooting] requests爬取中文网站后直接print,以及保存csv乱码
摘要: 问题: page = requests.get().text返回的中文不管是直接print,还是保存进csv都出现了乱码 背景: 我爬取的网站head里定义了charset=utf-8 本地windows系统默认编码是gbk 尝试: writerow()报错 - UnicodeEncodeError
阅读全文
posted @ 2018-05-16 07:36 break大蜗牛
阅读(209)
评论(0)
推荐(0)
2018年4月30日
[Trouble Shooting - Python] TypeError: 'builtin_function_or_method' object is not subscriptable
摘要: 1. Background: python 3/win10 2. Error Line: 3. Solution index()是对list的函数,所以要用圆括号,而不是方括号
阅读全文
posted @ 2018-04-30 06:48 break大蜗牛
阅读(4060)
评论(0)
推荐(0)
2018年3月25日
[python3 - package] PyMySQL
摘要: 1. 安装 pip install pymysql 2. 官方文档 https://pypi.python.org/pypi/PyMySQL 3. 基本用法
阅读全文
posted @ 2018-03-25 23:04 break大蜗牛
阅读(164)
评论(0)
推荐(0)
2018年3月20日
[database] MySQL 基本语句
摘要: 1. 创建数据库dbTest 2. 创建表pages 3. 增删改查 4. 删除表结构 5. 删除数据库
阅读全文
posted @ 2018-03-20 22:56 break大蜗牛
阅读(146)
评论(0)
推荐(0)
2018年3月15日
[database] MySQL Server/Workbench 安装入门
摘要: 1. 安装MySQL Server 下载地址:https://dev.mysql.com/downloads/windows/installer/ 32位和64位都是一样的 建议选大的那个。18M的在安装过程也是需要另外下载的,我下的时候超级慢,所以还是一步到位下载好吧。 安装的时候可以选择Serv
阅读全文
posted @ 2018-03-15 23:07 break大蜗牛
阅读(193)
评论(0)
推荐(0)
2018年2月25日
[Trouble Shooting - Python] Scrapy 安装问题
摘要: 1. Background: Python 3.6.4 + win10 2. Issue #1 Error Line: ModuleNotFoundError: No module named 'win32api' Solution: pip install pywin32 3. Issue #2
阅读全文
posted @ 2018-02-25 22:53 break大蜗牛
阅读(140)
评论(0)
推荐(0)
2018年2月22日
[python3 - package] re 正则表达式
摘要: 1. 官方文档 https://docs.python.org/3/howto/regex.html 2. 重复次数 3. 实例
阅读全文
posted @ 2018-02-22 22:24 break大蜗牛
阅读(140)
评论(0)
推荐(0)
上一页
1
2
3
4
下一页
公告