Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24851

Re: a problem about "print"

References (1 earlier) <CAEMsKDv0G40W61pbkUadzuRfe+eNVn5WS4iJDCioG+jTfeveYQ@mail.gmail.com> <CAJRADaOt3phGQ=afTy8TOX_qdtGv7zxfzvs2yp1S4GdgdZ=mkQ@mail.gmail.com> <CAEMsKDuejD6UcPrQ9LjiUxEEKjbY8Of7YS8O7kNo65hT3SerbQ@mail.gmail.com> <CAJRADaNqGOF+s-Eq_BNWh+4wsdPcVuttV0zWG1bmw_nyNFHM7Q@mail.gmail.com> <CAEMsKDv8vk0hkjPxd=xe=N7UmQzw9VYY1aTUaf3wk-CALEkJBw@mail.gmail.com>
Date 2012-07-04 17:40 +1000
Subject Re: a problem about "print"
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1780.1341387647.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jul 4, 2012 at 5:28 PM, levi nie <levinie001@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: a problem about "print" Chris Angelico <rosuav@gmail.com> - 2012-07-04 17:40 +1000

csiph-web