Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote: Dave Angel wrote: Since the script takes a mandatory argument, run it with one. python myscript.py Dave Better would be to change the script to check len(argv) for exactly 2, and tell the user how he should have run it. I would use

Re: problem with sys import argv

2013-03-26 Thread Thomas 'PointedEars' Lahn
Dave Angel wrote: > Since the script takes a mandatory argument, run it with one. > > python myscript.py Dave > > Better would be to change the script to check len(argv) for exactly 2, > and tell the user how he should have run it. I would use argparse.ArgumentParser instead.

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 01:26 PM, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userNam

Re: problem with sys import argv

2013-03-26 Thread Mark Lawrence
On 26/03/2013 17:26, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userName l

problem with sys import argv

2013-03-26 Thread leonardo selmi
hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userName likes = raw_input(prompt) print "where do you