逆转字符串

def aaa(oldstr):
    newlist = []
    for i in range(len(oldstr)-1,-1,-1):
        print(i)
        newlist.append(oldstr[i])
    print(''.join(newlist))

aaa('abcdefghijk')
print('abcdefghijk'[::-1])

posted @ 2018-06-25 17:55  xiaojinniu425  阅读(103)  评论(0编辑  收藏  举报