python - Urllib problom: AttributeError: 'module' object has no attribute 'maketrans' -


the environment win10 64-bit, python 2.7.12, anaconda. code quite simple web-scrapy:

import urllib  fhand = urllib.urlopen('http://www.reddit.com') line in fhand:     print line.strip() 

and result weird:

0.8475 traceback (most recent call last):   file ".\catch-web.py", line 1, in <module>     import urllib   file "c:\users\xxx\anaconda2\lib\urllib.py", line 30, in <module>     import base64   file "c:\users\xxx\anaconda2\lib\base64.py", line 98, in <module>     _urlsafe_encode_translation = string.maketrans(b'+/', b'-_') attributeerror: 'module' object has no attribute 'maketrans' 

the code run on other pc ipython, not work on one. have re-installed anaconda several times, failed.

i appreciate if solve it.

try spyder, works.

still no idea problem.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -