原本是想利用chardet模块识别一个混合编码网页的编码类型(以百度为例),然而运行脚本发现python3.X中出现“AttributeError: 'module' object has no attribute 'urlopen'就顺便说下子: 测试代码: 出现如下报错: 原因是python3.X把urllib模块拆分成了urllib.request和urllib.error,导入模块的时候应该import到具体的包: