python字符串反转时间:2023-03-10 07:19:00 最一般的想法就是将字符串先转换成列表,倒置列表,再将列表转换为字符串 s = 'Hello world' l = list(s) l.reverse() python ''.join(l) 而python是一个非常棒的语言,所以也有非常棒的方法,就是切片 s = "hello world" print s[::-1] 非常快速