代码 s = '12321' #定义字符串 print(str(''.join(list(reversed(s))))) print(s) # 输出字符串的逆序 print(s == str(''.join(list(reversed(s))))) 判断该字符串是否是回文字符串 运行结果