471,337 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

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
Nov 18 '07 #1
1 5074
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.

Similar topics

16 posts views Thread by qwweeeit | last post: by
reply views Thread by Curtiss Howard | last post: by
4 posts views Thread by dld_id | last post: by
10 posts views Thread by Mason Barge | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.