为什么Python代码过不了?

P5705 【深基2.例7】数字反转

Mudrobøt @ 2020-10-28 18:54:38

aa=input()
b=len(aa)
for i in range(1,b+1):
    print(aa[b-i],end='')

报错信息是第一个数读到了ASCII 13


by ud2_ @ 2020-10-28 19:05:10

因为确实有 '\r'


by 小甲鱼 @ 2020-10-28 19:11:15

1


by Mudrobøt @ 2020-10-28 19:53:02

@sjx233_ /r是什么啊?


by Mudrobøt @ 2020-10-28 20:52:33

@sjx233_ 那请问应该怎么修改呢?


by ud2_ @ 2020-10-28 21:16:43

@Mudrobøt input() 之后 .strip()(原因)


|