Access to raw command line?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Apr 26 03:20:21 EDT 2007


En Thu, 26 Apr 2007 04:04:30 -0300, Pieter Edelman <p.edelman at gmail.com>  
escribió:

> Now, one of the users has quite a lot of info files, and asked me if
> it's possible to use a wildcard in specifying these, so he would just
> have to do:
> ./myprog.py -t *.gpx *.jpg
>
> This seems like a sensible option at first sight, but it's difficult
> to implement because the wildcard is expanded by the shell, so
> sys.argv gets a list containing "-t", all .gpx files and all .jpg
> files. With this list, there's no way to tell which files belong to
> the "-t" switch and which are arguments (other than using the
> extension).

I can't verify right now, but I think that using -t "*.gpx" would avoid  
the shell expansion. (Or perhaps '*.gpx' or \*.gpx or even -t*.gpx)

-- 
Gabriel Genellina



More information about the Python-list mailing list