[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erp5-dev]dictionnary keys
From: |
Sébastien Robin |
Subject: |
[Erp5-dev]dictionnary keys |
Date: |
Mon, 26 May 2003 10:48:30 +0200 |
User-agent: |
KMail/1.5 |
With dictionnaries, it's a very good thing to use built-in functions
keys,
values and items. You can find some samples below :
>>> a = {1:2,2:3}
>>> a
{1: 2, 2: 3}
>>> for i in a: # This works, but this is not nice to read
... print i
1
2
>>> for i in a.keys(): # Good
... print i
1
2
>>> for i in a.values(): # Good
... print i
2
3
>>> for i in a.items(): # Good
... print i
(1, 2)
(2, 3)
Sebastien Robin
--
Sebastien ROBIN
About www.nexedi.com
Nexedi is a consulting and development services company helping small and
medium organisations to choose open source / free software and fulfill
their IT application needs. Nexedi is the founder of the ERP5 project, a
Free / Open Source ERP software based on innovative technologies
(www.erp5.org).
About www.storever.com
Storever provides a reliable source for OpenBrick, WiFi infrastructure,
notebooks and servers preconfigured with the GNU/Linux operating system
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erp5-dev]dictionnary keys,
Sébastien Robin <=