No subject

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Dec 12 19:43:55 EST 2007


On Wed, 12 Dec 2007 21:39:21 +0100, James Matthews wrote:

> Can you please explain better?

Please don't top post, it hurts readability a lot.

Katie, if you're still reading this, see below for my answer.



> On Dec 12, 2007 2:19 AM, katie smith <iceboy127 at yahoo.com> wrote:
>>
>> I tried googling and yahooing to find the answer and there was to many
>> conflicting results so i just decided to ask to simple question here.
>>
>> How do i could the number of letters in a string no a single letter all
>> of them.
>>
>> ex. 'Count this String'
>> should turn into an integer saying 17

By manually counting the letters in the string (including spaces), and 
getting 17, I expect that Katie wants to know the length of the string.

I think she's seen this:

>>> s = 'Count this String'
>>> s.count('n')
2

but not this:

>>> len(s)
17


-- 
Steven.



More information about the Python-list mailing list