我的代码:
import urllib.request
for num in range(1,31):
URL= "http://readcomicbooksonline.net/reader/mangas/Batman 2011/Batman Endgame Special Edition/njqr-"
IMAGE = str(num)+".jpg"
for i in range(1,(3-int(num/10))):
IMAGE="0"+IMAGE
print (IMAGE)
req = urllib.request.Request(str(URL+IMAGE), headers={'User-Agent': 'Mozilla/5.0'})
urllib.request.urlretrieve(req, str(IMAGE))
错误:
Traceback (most recent call last):
File "E:\Books, Papers and Certificates\Comics\Batman\EndGame\downloader.py", line 9, in <module>
urllib.request.urlretrieve(req, str(IMAGE))
File "C:\Users\Baidyanath Kundu\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 246, in urlretrieve
url_type, path = splittype(url)
File "C:\Users\Baidyanath Kundu\AppData\Local\Programs\Python\Python36-32\lib\urllib\parse.py", line 924, in splittype
match = _typeprog.match(url)
TypeError: expected string or bytes-like object
已编辑抱歉,我的错误是我发布了以前版本的代码。我已经更新了它。