How to iterate throuhg dictionary

Mark Robinson m.1.robinson at herts.ac.uk
Wed Aug 8 07:07:23 EDT 2001


Hi Piotr,

you might try something like:

for key in d.keys():
	print 'key:'
	for value in d[key]:
		print value



Piotr Legiecki wrote:

> Hi
> 
> I'v created dictionary named d={}. Its structure is like this: 
> 
> {key, [list]} 
> 
> I'd like to print all values stored in  'd'. What is the easiest way to do
> it?
> 
> Regards
> Piotr Legiecki




More information about the Python-list mailing list