Re: Using urlopen in Python2 and Python3

2015-08-24 Thread Cecil Westerhof
On Monday 24 Aug 2015 19:37 CEST, Ned Batchelder wrote: > On Monday, August 24, 2015 at 1:14:20 PM UTC-4, Cecil Westerhof wrote: >> In Python2 urlopen is part of urllib, but in Python3 it is part of >> urllib.request. I solved this by the following code: >>

Re: Using urlopen in Python2 and Python3

2015-08-24 Thread Ned Batchelder
On Monday, August 24, 2015 at 1:14:20 PM UTC-4, Cecil Westerhof wrote: > In Python2 urlopen is part of urllib, but in Python3 it is part of > urllib.request. I solved this by the following code: > > from platform import pyth

Using urlopen in Python2 and Python3

2015-08-24 Thread Cecil Westerhof
In Python2 urlopen is part of urllib, but in Python3 it is part of urllib.request. I solved this by the following code: from platform import python_version if python_version()[0] < '3': from urllib import urlope