a problem about "print"

Chris Angelico rosuav at gmail.com
Wed Jul 4 09:40:44 CEST 2012


On Wed, Jul 4, 2012 at 5:28 PM, levi nie <levinie001 at gmail.com> wrote:
> aList=str(aList)
> print aList
> print aList[2]

The str() function takes pretty much anything and returns a string.
When you subscript a string, you get characters. It's not a list of
numbers any more.

(Technically str is a class, not a function, but that distinction
doesn't matter.)

ChrisA



More information about the Python-list mailing list