Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Dictionary Built-in Functions

Here are the built-in functions that deal with dictionaries.

len ( object ) → integer

Return the number of items of a sequence or mapping.

dict ( valList ) → dictionary

Each element of the list must be a 2-element tuple; create a dict with the first element as the key and the second element as the value. Note that the zip function produces a list of 2-tuples from two parallel lists.

>>> 
dict( [('first',0), ('second',1), ('third',2)] )

{'second': 1, 'third': 2, 'first': 0}
>>> 
dict( zip(['fourth','fifth','sixth'],[3,4,5]) )

{'sixth': 5, 'fifth': 4, 'fourth': 3}

 
 
  Published under the terms of the Open Publication License Design by Interspire