判断一个字符串是否是回文字符串
#1.切片
a = "abcba12"
b = a[::-1]
print(b)
if a == b :
print(True)
else:
print(False)
# 2.reversed() # 迭代器
print(reversed(a)) # reversed object
print("".join(reversed(a))) # 得到字符串
print(a == "".join(reversed(a)))
判断一个字符串是否是回文字符串
#1.切片
a = "abcba12"
b = a[::-1]
print(b)
if a == b :
print(True)
else:
print(False)
# 2.reversed() # 迭代器
print(reversed(a)) # reversed object
print("".join(reversed(a))) # 得到字符串
print(a == "".join(reversed(a)))