标签:style font color weight span action 运动 int down
moves=[‘up‘,‘left‘,‘down‘,‘right‘,‘right‘]
def move_up(x):
    x[1]+=1
def move_left(x):
    x[1]-=1
def move_down(x):
     x[1] -= 1
def move_right(x):
     x[1] += 1
actions={
    ‘up‘ : move_up,
    ‘left‘:move_left,
    ‘down‘:move_down,
    ‘right‘:move_right
    }
coord=[0,0]
for move in moves:
    actions[move](coord)
    print (coord)标签:style font color weight span action 运动 int down
原文地址:http://www.cnblogs.com/xiaoxiaoshuaishuai0219/p/6163853.html