Re: [Tutor] Need help with converting script using 2.6's urllib2 to Python 3.1

2010-10-25 Thread Sander Sweers
On 25 October 2010 14:46, Richard D. Moores rdmoo...@gmail.com wrote: I'd like to convert the script to 3.1, but I can't understand the docs for the 3.1 urllib module. Please someone tell me what to do. (Converting   'print rate'   to   'print(rate)'   I understand.) Have you actually tried

Re: [Tutor] Need help with converting script using 2.6's urllib2 to Python 3.1

2010-10-25 Thread Richard D. Moores
On Mon, Oct 25, 2010 at 08:38, Sander Sweers sander.swe...@gmail.com wrote: Have you actually tried reading the documentation? Of course. Though I can see why you wondered. The _very_ first section of the urllib documentation we have urllib.request.urlopen [1]. Which looks to me what you are

Re: [Tutor] Need help with converting script using 2.6's urllib2 to Python 3.1

2010-10-25 Thread Richard D. Moores
And trying 2to3.py, which I've used successfully before, gets C:\P26Working\Finished\For2to32to3 -w -f urllib dollar2yen_rate_simple.py Traceback (most recent call last): File C:\P26Working\Finished\For2to3\2to3.py, line 2, in module from lib2to3.main import main File

Re: [Tutor] Need help with converting script using 2.6's urllib2 to Python 3.1

2010-10-25 Thread Sander Sweers
On 25 October 2010 18:19, Richard D. Moores rdmoo...@gmail.com wrote: Doing it your way, from urllib import request a = request.urlopen('http://www.marketwatch.com/investing/currency/CUR_USDYEN').read(20500) print(a[123:140]) succeeds. Why? Not sure how this exactly works but this is

Re: [Tutor] Need help with converting script using 2.6's urllib2 to Python 3.1

2010-10-25 Thread Richard D. Moores
So I finally find a relevant example in the docs: http://docs.python.org/py3k/library/urllib.request.html?highlight=urllib#examples The first example gave me some understanding and led me to revising my code to import urllib.request f =