Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread wesley chun
i strongly recommend you consider using the 2to3 tool if porting apps from 2.x to 3.x... it will show you much more than you may think. here's the output from the 2.7 version of 2to3: $ 2to3 test.py RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms R

Re: [Tutor] validating user input

2011-04-23 Thread Rance Hall
On Sat, Apr 23, 2011 at 6:38 PM, Alan Gauld wrote: > > "Rance Hall" wrote > >> Ok, so I have this code that is working, but does little to validate >> user input and I don't quite yet understand that process yet. >> >> so given the following function: >> >> def buildmenu(menuchoices): >>   for i,

Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread Alan Gauld
"pierre dagenais" wrote sock = urllib.urlopen("http://diveintopython.org/";) AttributeError: 'module' object has no attribute 'urlopen' What is the proper syntax in version 3? using help() shows that urllib has become a package in v3. The request module looked promising and sure enough

Re: [Tutor] validating user input

2011-04-23 Thread Alan Gauld
"Rance Hall" wrote Ok, so I have this code that is working, but does little to validate user input and I don't quite yet understand that process yet. so given the following function: def buildmenu(menuchoices): for i, option in enumerate(menuchoices, 1): Interesting, I didn't know enume

Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread Noah Hall
On Sat, Apr 23, 2011 at 11:58 PM, pierre dagenais wrote: > The following code works as expected with python version 2.6.5, but with > version 3.1.2 I get the following error: > > pierre:/MyCode/mesProjets$ py3 test.py > > Traceback (most recent call last): >  File "test.py", line 3, in >    sock

[Tutor] python2 vs python3 urllib

2011-04-23 Thread pierre dagenais
The following code works as expected with python version 2.6.5, but with version 3.1.2 I get the following error: pierre:/MyCode/mesProjets$ py3 test.py Traceback (most recent call last): File "test.py", line 3, in sock = urllib.urlopen("http://diveintopython.org/";) AttributeError: 'mod

[Tutor] validating user input

2011-04-23 Thread Rance Hall
Ok, so I have this code that is working, but does little to validate user input and I don't quite yet understand that process yet. so given the following function: def buildmenu(menuchoices): for i, option in enumerate(menuchoices, 1): print('%s. %s' % (i, option)) menuchoice = in

Re: [Tutor] (no subject)

2011-04-23 Thread Chris King
On 4/22/2011 6:48 PM, Brad Desautels wrote: Ya, I did try to run it and I am getting a syntax error before it runs. -Original Message- From: tutor-bounces+outsideme99=live@python.org [mailto:tutor-bounces+outsideme99=live@python.org] On Behalf Of R. Alan Monroe Sent: Friday, Apr

Re: [Tutor] return values function thanks

2011-04-23 Thread Alan Gauld
"Lea Parker" wrote Hi Alan Thanks once again for your help. Lea You are welcome but please when replying trim out the irrelevant stuff from the digest. Remember that some people either pay for their bandwidth or have a cap on usage (especially on mobile accounts) so sending lots of junk

Re: [Tutor] (no subject)

2011-04-23 Thread Alan Gauld
"Brad Desautels" wrote in message news:blu0-smtp18287b0b9ee400cce65b407de...@phx.gbl... Ya, I did try to run it and I am getting a syntax error before it runs. When asking for help with errors please post the actual error. Do not summarise it and do not shorten it. Similarly with the code,

Re: [Tutor] Python trouble

2011-04-23 Thread Alan Gauld
"Steven D'Aprano" wrote Ok let me try to be more clear. I am trying to write code in the IDLE Python GUI of python 2.7. start a command that goes over two or more lines, the prompt will change to three dots ... Sadly in IDLE it won't do this (I hate that feature of IDLE!) but it will ind

Re: [Tutor] python timers

2011-04-23 Thread Alan Gauld
"Brad Desautels" wrote Hello, my name is Brad and I am a student at Suny Plattsburgh. and Python programming is a course I am taking this semester. Hi, Welcome to the list. It will help in future if you do NOT reply to an existing message to start a new discussion. Doing so causes your me