[python] 修改list内容简便方式

1.     list_old = ['1 ','2 ','3']
        list_new = [i.strip() for i in list_old]

    等价于:

list_new = []
for i in list_old:
    list_new.append(i.strip())

 

posted @ 2013-07-22 15:49  浪潮之巅123  阅读(183)  评论(0编辑  收藏  举报