| View previous topic :: View next topic |
| Author |
Message |
Gladis
Joined: 24 May 2006 Posts: 108
|
Is there a way to check how many objects are in a tupel?
Is there an existing procedure, or shell i do it in a short for-loop? |
| |
|
|
|
|
WarChild
Joined: 24 Feb 2006 Posts: 46
|
| len(your_tuple) |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| Gladis: len() |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
Kopilman, sry, i meant to count lists
There is no len() attribute
Is there something simmilar? |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
Gladis: len() gives the length of almost everything.... it is a builtin... you dont call it on the object
Do like
L = [1,2,3]
Print len(l)
T = (1,2,3)
Print len(t) |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| Ah - ic, though list.len() |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| D = {1:'one', 2:'two'} |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| +t |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| Print len(d) |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
So this is the way, sure
Thanks |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| I am still a beginner and I have been using python for almost 10 years! |
| |
|
|
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| Kopilman, well, but a different kind of beginner i'd say ;) |
| |
|
|
|