How to replace the values with keys ?

Fredrik Lundh fredrik at pythonware.com
Wed Jul 23 03:19:58 EDT 2008


"Graps Graps" wrote:

> Text2 is a python dictionary containing data as
> 
> {0: 'a', 1: 'b', 2: 'c'...}
> 
> now I want the data in text1 to be replaced with the keys, say like
> 
> 0 1
> 0 2
> 0 3
> 0 6
> 1 2... so on..

someone asked a very similar question not long ago, so maybe you're 
really supposed to figure this out yourself.  I'm sure your teacher 
won't kill you if you ask for a hint.

(if you asked me for a hint, I'd tell you to look for questions about 
dictionaries in the mailing list archives).

</F>




More information about the Python-list mailing list