checkcode = {'0': '1', '1': '0', '2': 'X', '3': '9', '4': '8', '5': '7', '6': '6', '7': '5', '8': '5', '9': '3', '10': '2'} class Foo(): pass Foo.model=checkcode print(id(Foo.model)) print(Foo.model.get('0')) foo=Foo() foo.model=checkcode print(id(foo.model)) print(foo.model.get('0')) ''' 2131657178632 1 2131657178632 1 '''