试图制作代理刮刀,它总是说这个

时间:2017-10-10 15:50:10

标签: python proxy

CODE:

print ("FrogSquad4's Scraper v1.0")
import urllib, urllib2
import time, datetime
import threading, Queue
import re
import StringIO, gzip
import sys
input ("Press Enter to Start!")

ERROR:

Traceback (most recent call last):
  File "/Users/macbook/Desktop/ScraperInProgress.py", Line 2, in <module>
  import ullib, urllib2
ModuleNotFoundError: No Modile named 'urllib2'

1 个答案:

答案 0 :(得分:0)

这是适用于Python 2.7及更高版本的导入逻辑。

print ("FrogSquad4's Scraper v1.0/ver(https://github.com/djinn)")
import sys
if sys.version_info > (2, 7) and sys.version_info < (3, 0):
    import urllib, urllib2
    import Queue
    import StringIO
else:
    import urllib
    import queue
    from io import StringIO
import time, datetime
import threading
import re
import gzip
import sys
input("Press Enter to Start!")