I don't have Python on Windows and didn't want to make any assumptions
about the way the Windows shell passes parameters. Sorry again for being
trivial.

On Sun, 2005-12-04 at 09:00 +0000, Alan Gauld wrote:
> > My question is: when invoking a program with, let's say, a filename
> > containing spaces as a parameter:
> > 
> > myprog -file "Long name"
> > 
> > What does sys.argv hold in this case? 
> 
> What did you get when you tried it?
> 
> I  ran:
> 
> #######test.py ######
> import sys
> print sys.argv
> 
> ###################
> 
> python test.py foo "long name" bar
> 
> and got
> ['testargv.py', 'foo', 'long name', 'bar']
> 
> What did you get? Since its much less typing to try it than to ask 
> the question I assume you must have had a problem with it?
> 
> Alan G
> Author of the learn to program web tutor
> http://www.freenetpages.co.uk/hp/alan.gauld
> 
> 
> 
> and got
> 
> I am specifically interested in
> > whether argv[2]=="\"Long" or argv[2]=="Long name", that is, if the shell
> > does the processing or I need to do it in the program. Also, I need to
> > know if most environments do the same (I wouldn't want to be caught
> > pants down while porting this to Windows).
> > 
> > Many thanks in advance for your valuable suggestions and apologies if I
> > have misposted,
> > 
> > Vlad
> > 
> > 
> > 
> >


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to