[Tutor] Number of elements in a list

Nick Lunt nick at javacat.f2s.com
Fri Aug 13 23:07:52 CEST 2004


Hi Bernard,

try looking here for info about lists
http://docs.python.org/tut/node5.html#SECTION005140000000000000000

basically:

>>>mylist = [1,2,3,4]
>>>print len(mylist)
4

:)

Nick.



-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On
Behalf Of Bernard Lebel
Sent: 13 August 2004 23:02
To: tutor at python.org
Subject: [Tutor] Number of elements in a list


A very basic question: how can I print the number of elements in a list? I'm
not talking about the elements, just their count...

Something like

print myList.length
or
print myList.count


Thanks
Bernard

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list