立即学习:https://edu.csdn.net/course/play/26755/340115?utm_source=blogtoedu
反转字符串的方法:
普通:
s2 = ""
s1 = "ahbef"
for c in s1:
s2 = c + s2
切片:
s1 = "sjdfh"
print(s1[::-1])
立即学习:https://edu.csdn.net/course/play/26755/340115?utm_source=blogtoedu
反转字符串的方法:
普通:
s2 = ""
s1 = "ahbef"
for c in s1:
s2 = c + s2
切片:
s1 = "sjdfh"
print(s1[::-1])