By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

sys.arg whitespace problem

P: n/a
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
Nov 18 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Nov 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.