Okay, i have this string:
string = "HelloWorld"
And for this example, I am using a dictionary similar to this:
dic = [{'a':'k','b':'i'},{'a':'i','b':'l'},{'a':'x','b':'n'},{'a':'q','b':'o'}]
Now.. I need to reference a dictionary from the list, so that I can change the characters in my string. To do so normally I would just do this:
dic[#]
But in this case I also need a value from that dictionary. Now I tried this:
dic[int(char[i[letter]])]
But I get the error:
'int' object has no attribute '__getitem__'
Searching for the error gives me answers here on StackOverflow, but they do not fix my problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…