【发布时间】:2020-04-06 13:49:38
【问题描述】:
所以我有一个 Python 中的字符串列表
List=["Hello there", "Nice one"]
我想补充!在字符串的末尾,所以它变成了这样
List=["Hello there!", "Nice one!"]
我想我可以迭代使用 split() 将它们变成单独的数组,然后 append("!") 然后加入这是我目前所拥有的。
List=["Hello there", "Nice one"]
for i in List:
List[i].split()
List[i].append("!")
List[i].join()
print(List(i))
有人可以告诉我更好的方法或帮助我解决这个问题
【问题讨论】: