标签: python list
这让我发疯了。我在python中迭代一个列表,如果某些东西是空的,我想改变它的值。为什么这个简单的东西不起作用?
>>> list = ['WHY', 'this', 'isnt', '', 'working'] >>> for item in list: ... if item == '': ... item = 'Nevermind' ... >>> >>> print list ['WHY', 'this', 'isnt', '', 'working']