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'
答案 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!")