题解 | #坐标移动#python3过滤法
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
data = input().split(';')
e_command=[]
for command in data:
length = len(command)
if length == 3 or length == 2:
if command[0] in ['A','W','S','D'] and command[1:length].isdigit():
e_command.append(command)
x,y = 0,0
for i in e_command:
if i[0] == 'A':
x += -int(i[1:len(i)])
if i[0] == 'D':
x += int(i[1:len(i)])
if i[0] == 'S':
y += -int(i[1:len(i)])
if i[0] == 'W':
y += int(i[1:len(i)])
print('%d,%d'%(x,y))