urlopen in python3

Olive diolu.remove_this_part at bigfoot.com
Wed Dec 5 23:40:20 CET 2012


In python2, I use this code:

a=urllib.urlopen(something)

In python2, this work if "something" is a regular file on the system as
well as a remote URL. The 2to3 script convert this
to urllib.request.urlopen. But it does not work anymore if "something"
is just a file name. 

My aim is to let the user specify a "file" on the command line and have
something that works, whatever the "file " actually is: a regular file,
an http url, etc...

Olive



More information about the Python-list mailing list