《Dive Into Python》 的 Example 9.15. sitecustomize.py
# sitecustomize.py # this file can be anywhere in your Python path, # but it usually goes in ${pythondir}/lib/site-packages/ import sys sys.setdefaultencoding('utf-8')
SQLAlchemy的问题请参考这里
http://firefish.blog.51cto.com/298258/112794
create_engine(connstr+"?charset=utf-8", encoding='utf8', convert_unicode=True)