Reverse a string in Python

前端 未结 28 3581
南旧
南旧 2020-11-21 04:41

There is no built in reverse function for Python\'s str object. What is the best way of implementing this method?

If supplying a very conci

28条回答
  •  礼貌的吻别
    2020-11-21 04:50

    Reverse a string without python magic.

    >>> def reversest(st):
        a=len(st)-1
        for i in st:
            print(st[a],end="")
            a=a-1
    

提交回复
热议问题