Neat way to get rid of [" "] in sys.argv[n:] returns
- From: korean_dave <davidreynon@xxxxxxxxx>
- Date: Thu, 24 Jul 2008 13:48:46 -0700 (PDT)
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,
.
- Follow-Ups:
- Re: Neat way to get rid of [" "] in sys.argv[n:] returns
- From: Fredrik Lundh
- Re: Neat way to get rid of [" "] in sys.argv[n:] returns
- From: Bruno Desthuilliers
- Re: Neat way to get rid of [" "] in sys.argv[n:] returns
- Prev by Date: Re: Reading a file
- Next by Date: www sextv1 pl - Amazing porn video collection
- Previous by thread: Re: Reading a file
- Next by thread: Re: Neat way to get rid of [" "] in sys.argv[n:] returns
- Index(es):
Relevant Pages
|