1 name="felix" 2 #方法一: 3 name=name[::-1] 4 #方法二: 5 name2=list(name) 6 name2.reverse() 7 name=''.join(name2) 8 #方法三: 9 from funtools import reduce 10 name = reduce(lambda x,y:y+x,name)
1 name="felix" 2 #方法一: 3 name=name[::-1] 4 #方法二: 5 name2=list(name) 6 name2.reverse() 7 name=''.join(name2) 8 #方法三: 9 from funtools import reduce 10 name = reduce(lambda x,y:y+x,name)