string slice reverse python code example Example 1: reverse string in python 'hello world'[::-1] 'dlrow olleh' Example 2: python 3 slice reverse stringname[::-1]