Get keys from a dicionary

John Gordon gordon at panix.com
Fri Nov 11 11:25:19 EST 2011


In <8f5215a8-d08f-4355-a5a2-77fcaa32c92d at j10g2000vbe.googlegroups.com> macm <moura.mario at gmail.com> writes:

> I pass a nested dictionary to a function.

> def Dicty( dict[k1][k2] ):

That's not valid syntax.

> 	print k1
> 	print k2

> There is a fast way (trick) to get k1 and k2 as string.

Are you stating this can be done, or are you asking if it can be done?
Questions usually end with a question mark.  (Are you a native English
speaker?)

> Whithout loop all dict. Just it!

print "%s" % x

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list