Best Practice to Reverse Python String – Python Tutorial

By | August 1, 2019

To reverse a python string is very simple, in this tutorial, we will introduce two simple methods to do it. You can learn and do by following our tutorial.

reverse a python string

Method 1:

To reverse a string in python, we can do like this:

>>> s='123456'
>>> s=s[::-1]
>>> s

Method 2:

We also can use for in to reverse a string in python

>>> s='123456'
>>> str=''
>>> for t in s:
>>> str

As to me, the method one is the most simplest.