【发布时间】:2017-08-19 17:37:40
【问题描述】:
如果我有这个列表:
['hello', 'world', 'goodbye', 'world', 'food']
是否可以在不使用任何自动命令的情况下将每个 world 替换为任何其他单词,我正在考虑这样的事情:
if 'world' in list:
'world' in list == 'peace'
【问题讨论】:
-
什么是自动命令?
-
@MadPhysicist 类似 list.replace()
标签: python python-2.7 list