[Tutor] Building Starships -- object of type 'int' has no len()

Marc Tompkins marc.tompkins at gmail.com
Mon Aug 18 06:53:53 CEST 2014


On Sun, Aug 17, 2014 at 9:49 PM, Marc Tompkins <marc.tompkins at gmail.com> wrote:
> On Sun, Aug 17, 2014 at 9:40 PM, Terry--gmail <terry.kemmerer at gmail.com> wrote:
>> I found another place in Thunderbirdy to set 'plain text'.
>>
>> This is a test.
>>
>> Does the below code look correct now?
>>
>> --And did I reply correctly this time?  (Reply-All and keep only
>> tutor at python.org address...)
>>
>>
>> for line_number, row in enumerate(catalog2):
>>
>> for col, item in enumerate(row):
>>
>> if lens[col] < len(item):
>>
>> lens[col] = len(item)
>
> 1)  It's plain text - no more funky font changes.
> 2)  Addressing is good.
> 3)  Indentation is still flat.

It just occurred to me: how are you indenting?  If you're using tabs,
that would explain the problem (TBird might be helpfully converting
tabs to newlines); in any case, the usual Python convention is to use
four spaces for indentation (it's pretty easy to set your text editor
to convert tabs to spaces on-the-fly, too.)
If you're already using spaces, please disregard.


More information about the Tutor mailing list