Just a quick one

SM sjmaster at gmail.com
Wed Aug 25 23:08:02 CEST 2004

"M. Clift" <noone at here.com> wrote in message news:<cgi5vc$m52$1 at news7.svr.pol.co.uk>...
> Sorry, another question. How do I remove the brackets form the list?
> Name_List.remove('(') doesn't work.

The parentheses or brackets are not "in" the tuple or list. They are
used in the representation of tuples or lists. The tuple ('Bob',
'Mary') consists of two objects, the string "Bob" and the string
"Mary". But when we describe a tuple using the canonical notation, we
put parentheses around the elements, and we put commas between them.
Those are part of the representation, not part of the tuple.
(Likewise, when I say 'the string "Bob" and the string "Mary"', the
double quote marks around each name are not part of the string, they
are part of how you represent a string.)

If you want to remove parentheses and commas from printing a tuple,
then don't print the whole tuple, but loop through it and print each

More information about the Python-list mailing list