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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • korean_dave

    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.envir on[param])

    print(os.enviro n['PATH'])

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

    python test.py "testparame ter"

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