Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 08:12 PM, Alan Gauld wrote: On 17/04/13 20:27, Danilo Chilene wrote: import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c': pr

[Tutor] new to threading, Queues

2013-04-17 Thread Chuck Mayers
Hi! I was having a bit of nostalgia today, and thought I'd try to write a simple, old school BBS. I found the 'paramiko' library, and I've got something I can SSH into that would have impressed my 1990's self. I found some example code of the "threading" library, and I've managed to use it to ta

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Alan Gauld
On 17/04/13 20:27, Danilo Chilene wrote: import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c': print c I run python file.py a and returns t

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Dave Angel
-- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is changing is just the sys.argv[1] The vars will have always the same content. What I don't want is to hav

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Mark Lawrence
On 17/04/2013 20:27, Danilo Chilene wrote: Dear Python Tutor, I have the code below(file.py): import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c':

[Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Danny Yoo
Forwarding message to Python-tutor mailing list. I did not realize that your reply didn't show up for the rest of Python tutor. Please use Reply to All in the future. -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 05:15 PM, Danny Yoo wrote: Yup! Sorry about my tone for its stridency. But I just got concerned that the original poster seemed content about turning the chain of if statements into a table definition. To my mind, they're very closely related, data and control. I'm trying to pus

[Tutor] PyCamp Registration Open for Columbus, Toronto, and Oshkosh

2013-04-17 Thread Chris Calloway
Registration is open for three upcoming PyCamps produced by the Triangle Python Users Group: - A five-day PyOhio PyCamp hosted by the Ohio State University Open Source Club, July 22-26, 2013 the week prior to the PyOhio regional Python conference weekend. PyCamp is a training program and spons

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Danny Yoo
Yup! Sorry about my tone for its stridency. But I just got concerned that the original poster seemed content about turning the chain of if statements into a table definition. To my mind, they're very closely related, data and control. I'm trying to push the OP to realizing that if they are doin

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 04:49 PM, Danny Yoo wrote: Wait. If the solution that we're stopping at to use a hashtable here, that's not quite right. Nothing wrong with a dict, if a proper specification of the problem were available. Notice that in my solution, the messages were not all trivially related

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Danny Yoo
Wait. If the solution that we're stopping at to use a hashtable here, that's not quite right. A good solution to this should be _much_ shorter, on the order of a one-liner. Hashtables are great, but they're not the answer to everything. If we're doing something like: a -> "This is A" b

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Danilo Chilene
Hello Dave, 1) I'm using Python 2.7 2) The program wasn't suppose to really work, was just a example. 3) You assumed correct. That's was what I looking for, worked like charm. Thanks! On Wed, Apr 17, 2013 at 5:18 PM, Dave Angel wrote: > On 04/17/2013 03:27 PM, Danilo Chilene wrote: > >> Dear

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Marc Tompkins
On Wed, Apr 17, 2013 at 1:03 PM, Danny Yoo wrote: > ## > ## double: string -> string > def double(x): > return x + x > > > ## For example, a blast from the past: > print "The Noid says: " + double("pizza") > ## > I'm sorry, but this is a bug.

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 03:27 PM, Danilo Chilene wrote: Dear Python Tutor, I have the code below(file.py): import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Danny Yoo
What's the part that's "changing"? What's the part that stays the same? I would recommend thinking of this in terms of a function. Can you write a function that consumes a letter l and returns the string "This is ..." where "..." is the uppercased l? As an example of a simple function on string

[Tutor] Sys.argv read parameters

2013-04-17 Thread Danilo Chilene
Dear Python Tutor, I have the code below(file.py): import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c': print c I run python file.py a and return

Re: [Tutor] Tutor Digest, Vol 110, Issue 74

2013-04-17 Thread Timo
Op 17-04-13 18:09, Jim Mooney schreef: The script 2to3.py is run from the system's terminal/console shell (e.g. cmd or PowerShell on Windows), not the python shell. Yay, it worked! A decade of Windows and I'm back to the DOS Command Line ;') If you want to program, the command line is your frien

Re: [Tutor] Tutor Digest, Vol 110, Issue 74

2013-04-17 Thread Jim Mooney
> The script 2to3.py is run from the system's terminal/console shell > (e.g. cmd or PowerShell on Windows), not the python shell. Yay, it worked! A decade of Windows and I'm back to the DOS Command Line ;') Well, it worked the second time.I thought I could do without the -w but nothing happened.

Re: [Tutor] regex to promote Py 2 to Py 3?

2013-04-17 Thread Walter Prins
Hi, On 17 April 2013 06:11, Jim Mooney wrote: > > Generally the 2to3 script does an OK job. If you're using Windows it's > > [Python_Dir]\Tools\Scripts\2to3.py. > > > > http://docs.python.org/3/library/2to3 > > > Thanks. I didn't know where to find it and though

Re: [Tutor] regex to promote Py 2 to Py 3?

2013-04-17 Thread eryksun
On Wed, Apr 17, 2013 at 1:11 AM, Jim Mooney wrote: 2to3 loops.py > File "", line 1 > 2to3 loops.py >^ > SyntaxError: invalid syntax The script 2to3.py is run from the system's terminal/console shell (e.g. cmd or PowerShell on Windows), not the python shell. If the current dire