【发布时间】:2022-01-25 12:25:04
【问题描述】:
对于初学者我是这样做的
text = "Hello I want to make this code better"
x = text.split()
sorted_characters = sorted(x[5])
sortedword = "".join(sorted_characters)
print(sortedword)
我希望代码执行此操作,但我不知道如何分隔单词和列表中的每个字符串:
example=['I like python', 'I like reading books']
输出应该是['I eikl hnopty', 'I eikl adeginp bkoos']
【问题讨论】:
标签: python python-3.x list function sorting