python这样写为什么不行啊

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

__memorial__ @ 2023-06-06 19:42:06

x = input() y = x[::-1] print(y)


by Terrible @ 2023-06-06 19:46:34

@memorial 行尾有回车符 \r,需要用.strip()清理一下

print(input().strip()[::-1])

by __memorial__ @ 2023-06-06 19:50:55

@Terrible 懂了。谢谢!


|