question regarding dictionaries

Emile van Sebille emile at fenx.com
Thu Nov 1 10:29:45 EST 2001


"Rajarshi Guha" <rxg218 at psu.edu> wrote in message
news:9rrp75$qai at r02n01.cac.psu.edu...
> Hi,
>   I have a question regarding dictionaries. When I compare them as
>
> if (dict1 == dict2):
>   print 'ok'
>
> Where dict1 and dict2 shoudl have the same key and corresponding key
values.
> It seems to work. Is it meant to work, or am I just being lucky.
>

Yes.    (...it's meant to work  ;-)

> And secondly why won't thjis work:
>
> for i,j in list1,list2:
>   #do something with i and j
>

try:

for i,j in zip(list1, list2):

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list