Copyright © tutorialspoint.com

Python dictionary len() Function

previous next


Description:

This function gives the total length of the dictionary. This would be equal to the number of items in the dictionary.

Syntax:

len(dict)

Parameters:

Here is the detail of parameters:

Example:

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7};
print "Length : %d" % len (dict)

This produces following result:

Length : 2

previous next

Copyright © tutorialspoint.com