摘要: 三篇文章,导航:(一)(二)(三) (一) 怎么避免UnicodeEncodeError: ‘ascii’ codec can’t…类似的错误? 1、首先在py文件头部指定文件内容编码,例如:# coding: utf8 2、文件保存的时候要和py文件头部编码一致 3、在用decode和encode的时候,一定要确认要转换的字符原编码是什么。 例如:网页中都会指定编码(<meta http-equ... 阅读全文
posted @ 2011-08-03 16:37 $walker 阅读(3225) 评论(0) 推荐(0) 编辑
摘要: 发现python有个好用的检查模块-inspect, 查看源文件发现它提供了不少好用的方法: “”" Here are some of the useful functions provided by this module:ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(), isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),isroutine() – check object typesgetmembers() .. 阅读全文
posted @ 2011-08-03 10:45 $walker 阅读(4772) 评论(2) 推荐(0) 编辑