如何在python中反转字符串

Gun*_*shi -6 python

如何在python中反转字符串?我的输入字符串是"嘿枪"现在我想显示"Gun Hey"作为输出.我已经尝试使用像[:: - 1]这样的切片运算符,但它不会显示正确的输出如何在python中工作?

Avi*_*Raj 6

分裂然后反转然后加入.

' '.join(string.split()[::-1])
Run Code Online (Sandbox Code Playgroud)