<分区> 分区>
Possible Duplicate:
Reverse the ordering of words in a string
我知道 python 已经为此提供了一些方法,但我试图了解当您只有列表数据结构时这些方法如何工作的基础知识。如果我有一个字符串 hello world 并且我想创建一个新字符串 world hello,我会怎么想?
然后,如果我可以使用新列表来完成,我将如何避免制作新列表并在原地进行?
<分区> 分区>
Possible Duplicate:
Reverse the ordering of words in a string
我知道 python 已经为此提供了一些方法,但我试图了解当您只有列表数据结构时这些方法如何工作的基础知识。如果我有一个字符串 hello world 并且我想创建一个新字符串 world hello,我会怎么想?
然后,如果我可以使用新列表来完成,我将如何避免制作新列表并在原地进行?