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



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,
.



Relevant Pages

  • Re: Neat way to get rid of [" "] in sys.argv[n:] returns
    ... import sys ... for param in os.environ.keys: ... python test.py "testparameter" ...
    (comp.lang.python)
  • Re: Performance issue
    ... while the python takes 30 seconds. ... Try to avoid assigning to the names of built-in functions if you can. ... sort(), as they slow the operation considerably. ... sys 0m0.013s ...
    (comp.lang.python)
  • RE: A question on python performance.
    ... To get the element directly from the object, Python has to ... for param, or getattrif param is dynamic. ... Bruno Desthuilliers wrote: ... posted well enough yet to even ask a useful question. ...
    (comp.lang.python)
  • Re: stdin, stdout, redmon
    ... "import sys ... But I reinstalled Python 2.5 under Windows XP and it doesn't work anyway. ... Bernard Desnoues wrote: ... Redmon send the data flow to the standard input and lauchs the Python program which send modified data to the standard output. ...
    (comp.lang.python)
  • Re: stdin, stdout, redmon
    ... I don't know what you did with your Python installation, but for me this works perfectly. ... Bernard Desnoues wrote: ... |import sys ... Redmon send the data flow to the standard input and lauchs the Python program which send modified data to the standard output. ...
    (comp.lang.python)