s1 = 'abcde' # 使用循环 s2 = '' for c in s1: s2 = c + s2 print(s2) #使用分片 s2 = s1[::-1] print(s2) edcba edcba