macint0sh

about me

Python随笔

24 Dec 2015

python 中文注释方法官方网站

python默认ASCII     
定义方法[必须在文档的第一或者第二行添加,可选编码gbk/utf-8/ascii等]:        
1. #coding=utf-8                
2. # -*- coding: utf-8 -*-       
3. # vim: set fileencoding=utf-8        

python使用requests库中文GBK乱码

检查网页head是否包含类似charset=gb2312的说明
res = requests.get(html)
res.encoding = 'gb2312'
print(res.text)

Scrapy: twisted.python.failure.Failure twisted.internet.error.ConnectionDone: Connection was closed cleanly

编辑settings.py文件USER_AGENT项

Scrapy: 503 Service Unavailable

编辑settings.py文件DOWNLOAD_DELAY项

Python 错误

Q: redshift-gtk ::: AttributeError: module 'gi' has no attribute 'require_version'       
A: pip install pygobject    

pip 安装特定版本的 Python 包

#pip2 install -v ipython==5.4    

Jupyter 支持 C

# pip install jupyter-c-kernel    
# install_c_kernel    
$ jupyter-notebook