Skip to content Skip to sidebar Skip to footer

Key Error '0' With Dict Format

I'm still a beginner in Python, and I wanted to know why this : dict = {} dict[0] = '123' a = 0 if dict['{}'.format(a)]['{}'.format(a)] == '1': print('True'

Solution 1:

You're trying to compare the key 0 with "0". They are different. One is an integer and another is a string.


Post a Comment for "Key Error '0' With Dict Format"