korean_dave wrote:

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 ''?

Since you're using slicing instead of indexing, you're printing a list, not a single string. There is no '[ or ]' in the string itself, and no
need to replace it with anything.

To print just that string, do

    print sys.argv[1] # fetch item

instead of

    print sys.argv[1:] # slice list

I suggest working through a tutorial or two. Pay special attention to the difference between an object's value and the various ways that value can be output.

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to