代码如下: content = input("请输入一段文字:") if name == name[::-1]: print("是回文") else: print("不是回文") 转载于:https://www.cnblogs.com/xiaozhangpython/p/9878927.html