当前位置 博文首页 > Python 字符串中的字符倒转

    Python 字符串中的字符倒转

    作者:admin 时间:2021-02-02 15:08

    方法一,使用[::-1]:
    s = 'python'
    print s[::-1]

    方法二,使用reverse()方法:
    l = list(s)
    l.reverse()
    print ''.join(l)
    输出结果:
    nohtyp
    nohtyp
    js
    下一篇:没有了