Neat way to get rid of [" "] in sys.argv[n:] returns

K

korean_dave

so, i code this:
-----------------------------
#!/usr/bin/python

import sys
import os

for param in os.environ.keys():
print "%20s %s" % (param,os.environ[param])

print(os.environ['PATH'])

print(sys.argv[1:])
--------------------------
and then when i type in -->

python test.py "testparameter"

I get this output:

-------------
['testparameter']
----------------

Is there a way to neatly, in one call to the parameter, to get rid of
the [' and '] without bothering to replace() '[ with "" and replace()
'] with ''?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,250
Members
46,848
Latest member
Graciela Mitchell

Latest Threads

Top