difference between string and list

lincoln rutledge lincolnr at oar.net
Tue Feb 27 16:00:25 EST 2007


Hi Skip,
Okay, I actually have those pages up in my browser.  I found the string
methods:
http://docs.python.org/lib/string-methods.html

But I am having trouble finding the same information for lists...

Thanks I will look into it some more,
Lincoln

>>> <skip at pobox.com> 02/27/07 3:28 PM >>>

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

Similar in some ways, different in others.  Some things to play with:

    1. At an interpreter prompt, execute:

        help("")
        help([])

    2. Check the relevant sections of the tutorial:

       
http://docs.python.org/dev/tut/node5.html#SECTION005120000000000000000
       
http://docs.python.org/dev/tut/node5.html#SECTION005140000000000000000

Two significant differences:

    1. Strings are immutable.

    2. Lists can contain any kind of object, not just characters.

Skip





More information about the Python-list mailing list