difference between string and list

lincoln rutledge lincolnr at oar.net
Tue Feb 27 14:55:24 EST 2007


I'm having trouble figuring out the difference between a string and a
list.

I know that:
string = "foo bar"

is a list of characters, "foo bar", and string[0] is "f".

while:

list = ["foo", "bar"]
and list[0] is "foo".

strings have methods like string.count("f") returns 1.  What methods do
lists have?  Is it a similar class to string?

thanks,
Lincoln




More information about the Python-list mailing list