学到了~
def str_reverse(str): strout = str[::-1] return strout a = 'abcdefg321' b = str_reverse(a) print b c = a[::-1] print c
结果
123gfedcba