几乎。你想要的是
shapes = {'1':Square, '2':Circle, '3':Triangle} # just the class names in the dictx = shapes[raw_input()]() # get class from dict, then call it to create a shape instance.
几乎。你想要的是
shapes = {'1':Square, '2':Circle, '3':Triangle} # just the class names in the dictx = shapes[raw_input()]() # get class from dict, then call it to create a shape instance.