[Tutor] how i can change two lists into one directory

Alex Hall mehgcap at gmail.com
Fri Jul 23 02:08:53 CEST 2010


On 7/22/10, ANKUR AGGARWAL <coolankur2006 at gmail.com> wrote:
> hey i have just started making  a app using python and just gt a problem..
>
> i have two list
> a=["x","z"]
> b=[1,2]
>
> i want to make a directory like this
It is called a dictionary, actually.
> c={"x":1,"z":2}
>
> is it possible???? i mean i tried it using loops and all but i cant append a
> directory so i m unable to do this...
> plz tell me if there's any way to get the directory like this.... Thanks in
> advance :):)
idx=0
for i in a:
    c[i]=b[idx]
    idx+=1
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap


More information about the Tutor mailing list