As you’re using Python 3, there is no urllib
module anymore. It has been split into several modules.
This would be equivalent to urlretrieve
:
import urllib.request data = urllib.request.urlretrieve("http://...")
urlretrieve
behaves exactly the same way as it did in Python 2.x, so it’ll work just fine.
Basically:
urlretrieve
saves the file to a temporary file and returns a tuple(filename, headers)
urlopen
returns aRequest
object whoseread
method returns a bytestring containing the file contents
Related Posts:
- AttributeError: ‘module’ object has no attribute ‘urlopen’
- Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?
- installing urllib in Python3.6
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- Python 3.5.1 urllib has no attribute request
- Python: urllib.error.HTTPError: HTTP Error 404: Not Found
- ‘module’ has no attribute ‘urlencode’
- SyntaxError: unexpected EOF while parsing
- How to use filter, map, and reduce in Python 3
- converting time from UTC to CST
- Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How to install pip with Python 3?
- Import Error: No module named numpy
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- How to uninstall a package installed with pip install –user
- Best way to convert string to bytes in Python 3?
- How is Anaconda related to Python?
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- How to install python3 version of package via pip on Ubuntu?
- Updating a dictionary in python
- Local variable referenced before assignment?
- How to download a file over HTTP?
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- TypeError: ‘float’ object not iterable
- ‘method’ object is not subscriptable. Don’t know what’s wrong
- Importing class from another file [duplicate]
- Dice rolling simulator in Python
- csv.Error: iterator should return strings, not bytes
- NameError: global name ‘xrange’ is not defined in Python 3
- What does “SyntaxError: Missing parentheses in call to ‘print'” mean in Python?
- What is __pycache__?
- TypeError: can’t use a string pattern on a bytes-like object in re.findall()
- TypeError: method() takes 1 positional argument but 2 were given
- How can I get a list shape without using numpy?
- How to install pip3 on Windows?
- Python Setup Disabling Path Length Limit Pros and Cons?
- Type error: cannot convert the series to
- How can I flush the output of the print function?
- What is the purpose of “pip install –user …”?
- Why Am I Getting ELIF Invalid Syntax Error?
- How to remove punctuation marks from a string in Python 3.x using .translate()?
- Infinite integer in Python
- ‘pip3’ is not recognized as an internal or external command, operable program or batch file
- Generate random sentences in python
- How to use sys.exit() in Python
- How do you use subprocess.check_output() in Python?
- Dice rolling simulator in Python
- What is sys.maxint in Python 3?
- Get degree of each nodes in a graph by Networkx in python
- List attributes of an object [duplicate]
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Convert bytes to int?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- AttributeError(“‘str’ object has no attribute ‘read'”)
- Python: can’t assign to literal
- “Initializing” variables in python?
- Difference between except: and except Exception as e:
- “Unicode Error “unicodeescape” codec can’t decode bytes… Cannot open text files in Python 3
- How to downgrade python from 3.7 to 3.6
- How to return dictionary keys as a list in Python?
- How to save a dictionary to a file?
- TypeError; Must use key word argument or key function in python 3.x
- Type error Unhashable type:set
- Youtube_dl : ERROR : YouTube said: Unable to extract video data
- Using Look Up Tables in Python
- Anaconda Installed but Cannot Launch Navigator
- How to print multiple lines of text with Python
- ImportError: No module named ‘cv2’ Python3
- urllib2.HTTPError: HTTP Error 403: Forbidden
- Django Rest Framework — no module named rest_framework
- Unsupported operation :not writeable python
- Object of type ‘map’ has no len() in Python 3
- how to exit a python script in an if statement
- How to fix ‘RuntimeWarning: divide by zero encountered in double_scalars’
- Not able to pip install pickle in python 3.6
- Using unicode character u201c
- Decode Hex String in Python 3
- built-in range or numpy.arange: which is more efficient?
- Printing subscript in python
- Why do I get this error “TypeError: ‘method’ object is not iterable”?
- How to clear Tkinter Canvas?
- TypeError: ‘range’ object does not support item assignment
- Download Returned Zip file from URL
- install csv package in pycharm
- dump() missing 1 required positional argument: ‘fp’ in python json
- Meaning of list[-1] in Python
- TypeError: module.__init__() takes at most 2 arguments (3 given)
- Tkinter error: Couldn’t recognize data in image file
- How to install Openpyxl with pip
- Python cant convert ‘list’ object to str error [closed]
- Getting a name error when trying to input a string [duplicate]
- Generate a random letter in Python
- What’s the correct way to convert bytes to a hex string in Python 3?
- During handling of the above exception, another exception occurred
- Python-3.2 coroutine: AttributeError: ‘generator’ object has no attribute ‘next’
- How to install PyQt4 on Windows using pip?
- How to install PyQt4 on Windows using pip?
- Python 3 integer division [duplicate]