莫名其妙报module 'urllib' has no attribute 'request'的解决方法

以前在pycharm下运行好好的程序,今天就加了两个log,莫名其妙报错说urllib下找不到request...
报错:module 'urllib' has no attribute 'request'

查了下,据说python3有时候会抽风不会将子模块自动导入进去,所以稳妥起见,还是改成:

import urllib.request

这样就行了.....很无语

猜你喜欢

转载自my.oschina.net/u/2396236/blog/1621949