One step up from str.split()

Sion Arrowsmith siona at
Tue Jul 15 10:21:13 EDT 2008

Joel Koltner <zapwireDASHgroups at> wrote:
>I normally use str.split() for simple splitting of command line arguments, but 
>I would like to support, e.g., long file names which-- under windows -- are 
>typically provided as simple quoted string.  E.g.,
>myapp --dosomething --loadthis "my file name.fil"
>...and I'd like to get back a list wherein ListEntry[3]="my file name.fil" , 
> [ ... ]

Hang on, let's back up here a second. You want a command line like

>myapp --dosomething --loadthis "my file name.fil"

to be available as ['--dosomething', '--loadthis', 'my file name.fil'] ?

What's wrong with sys.argv ?

\S -- siona at --
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list