Size of list

E

Ernesto

for line in PM_File_Handle.readlines():
PM_fields = line.split(';')

# Is there a way to get the size of PM_Fields here ?
# Something like

size = PM_fields.size( )

# I could not find this attribute in the python docs. Thanks
 
L

limodou

6 Feb 2006 08:32:18 -0800 said:
for line in PM_File_Handle.readlines():
PM_fields = line.split(';')

# Is there a way to get the size of PM_Fields here ?
# Something like

size = PM_fields.size( )

# I could not find this attribute in the python docs. Thanks

try:

size = len(PM_fields)
 
?

=?ISO-8859-1?Q?Sch=FCle_Daniel?=

lst = [1,2,3]3

in genereal all objects which implements __len__
can be passed to built-in function len<built-in function len>

just to give one example how this can be used
.... def __len__(self):
.... print "this instance has __len__"
.... return 100
....this instance has __len__
100this instance has __len__
100

hth, Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top