Here's my problem:
Say I have two dictionaries, dict_a and dict_b
Each of them has the same keys and values that I can manipulate in the same way, and in fact it is that I am codeing in a large part. Only I do not want to write it twice. However, I can not do anything like this:
if select_a == 1: in dict_a.iteritems () for X and Y: # geto line 20 if select_b == 1: for x And y in dict_b.iteritems (): # Goto line 20 # Line 20 # stuff with x and y Except that I do not know what kind of situation. If there is such a thread, please tell me, and forgive me if I have violated anything (first post). Thanks in advance, I appreciate any help
Maybe something like this:
< Pre> if select_a == 1: The_dict = dict_a elif select_b == 1: For X the_dict = dict_b, the_dict.iteritems () do stuff with y: x and y.
Comments
Post a Comment