Sorry this might be a very stupid question. But I did have bug with the following naming.
for i in my_hash_dict: #1st
for y in my_hash_dict[i]:
do something with i ...
for i in my_hash_dict: #2nd
do something with i...
the problem is seems like if I reusing i this name in 2nd for loop , it "seems" will cost my program not running correctly. If I change the i in 2nd for loop, then seems everything working fine...
Maybe it just some of my stupid typo or something else cause this problem.
But I hope experiecned python programmer can give me some answers... Thankyou
2 Answers 2
The problem is that you are using the 'i' element as index.
Probably this code will work for you:
for element in my_hash_dict:
for y in element:
do something with y ...
Comments
Its a syntax issue as Tichodroma mentioned, take a look at this documentation, your example looks fine you just need to add the : if you still get an unexpected output please post it.
:at the end of theforline. Please post some real Python code.