Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

sys.arg whitespace problem

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


rasmussen.bryan at gmail

Nov 18, 2007, 7:27 AM

Post #1 of 2 (80 views)
Permalink
sys.arg whitespace problem

Hi,

Basically I want to get sys.argv[1: ] but the problem is that actually
the argument should maintain whitespace. Thus if the arguments are
something something with only one space between them, or something
something with three spaces between them I should be able to maintain
the exact whitespace between arguments.

Cheers,
Bryan Rasmussen
--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Nov 18, 2007, 7:40 AM

Post #2 of 2 (69 views)
Permalink
Re: sys.arg whitespace problem [In reply to]

bryan rasmussen schrieb:
> Hi,
>
> Basically I want to get sys.argv[1: ] but the problem is that actually
> the argument should maintain whitespace. Thus if the arguments are
> something something with only one space between them, or something
> something with three spaces between them I should be able to maintain
> the exact whitespace between arguments.


That has nothing to do with python - it's a question of your shell.
Because the shell is responsible for parsing the arguments, possibly
instantiating variables or even executing subcalls. The resulting
argument list is then passed to the C-main of python.

So to pass arguments containing whitespace to python, do

python myscript.py "an argument with whitespac in it" "another one"

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.