Command line arguments??

Gerry gerard.blais at gmail.com
Tue Nov 17 14:47:46 EST 2009


On Nov 17, 2:26 pm, Nobody <nob... at nowhere.com> wrote:
> On Mon, 16 Nov 2009 23:30:09 +0000, Rhodri James wrote:
> > Quote the filenames or escape the spaces:
>
> > C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt"
>
> > We've been living with this pain ever since windowed GUIs encouraged users  
> > to put spaces in their file names (Apple, I'm looking at you!).  
> > Fundamentally, if people want the pretty they have to live with the  
> > consequences.
>
> We've been living with much worse ever since Unix allowed users to put
> not only spaces but even newlines in their filenames.
>
> At least, those of us who prefer "works" over "sort of works most of the
> time" have.
>
> Then Python 3 decides to pretend that argv and environ and stdin contain
> text rather than bytes, thereby ensuring that Python 2 will outlive Python
> 3.

How about this:

lastarg = " ".join(sys.argv[2:])



More information about the Python-list mailing list