lincoln rutledge a écrit : > I'm having trouble figuring out the difference between a string and a > list.
['R', 'e', 'a', 'l', 'l', 'y', ' ', '?', ' ', 'S', 'e', 'e', 'm', 's', ' ', 'q', 'u', 'i', 't', 'e', ' ', 'o', 'b', 'v', 'i', 'o', 'u', 's', ' ', 't', 'o', ' ', 'm', 'e', '.'] > I know that: > string = "foo bar" > > is a list of characters No. It's a string. Python doesn't have a "character" type. >, "foo bar", and string[0] is "f". Yes. And ? > while: > > list = ["foo", "bar"] > and list[0] is "foo". So ? > strings have methods like string.count("f") returns 1. What methods do > lists have? Open your interactive Python interpreter and type >>> help(list) > Is it a similar class to string? Not exactly. Both are sequences, that's all. FWIW, try this: "foo"[0] = "b" HTH -- http://mail.python.org/mailman/listinfo/python-list