讨论数量:
How to describe your issue
Summarize the problem
- Include details about your goal
- Describe expected and actual results
- Include any error messages
Describe what you’ve tried
- Show what you’ve tried and tell us what you found (on this site or elsewhere) and why it didn’t meet your needs. You can get better answers when you provide research.
Show some code
- When appropriate, share the minimum amount of code others need to reproduce your problem (also called a minimum, reproducible example)
应该是你的代码有问题, 你又什么都没提 ...
>>> url = 'http://py4e-data.dr-chuck.net/comments_845667.html'
>>> html = urllib.request.urlopen(url).read()
>>>
>>> url = ''
>>> html = urllib.request.urlopen(url).read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Software\Python\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Software\Python\lib\urllib\request.py", line 510, in open
req = Request(fullurl, data)
File "C:\Software\Python\lib\urllib\request.py", line 328, in __init__
self.full_url = url
File "C:\Software\Python\lib\urllib\request.py", line 354, in full_url
self._parse()
File "C:\Software\Python\lib\urllib\request.py", line 383, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: ''
>>>
>>> url = 'py4e-data.dr-chuck.net/comments_845667.html'
>>> html = urllib.request.urlopen(url).read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Software\Python\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Software\Python\lib\urllib\request.py", line 510, in open
req = Request(fullurl, data)
File "C:\Software\Python\lib\urllib\request.py", line 328, in __init__
self.full_url = url
File "C:\Software\Python\lib\urllib\request.py", line 354, in full_url
self._parse()
File "C:\Software\Python\lib\urllib\request.py", line 383, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'py4e-data.dr-chuck.net/comments_845667.html'
>>>
推荐文章: