python列表操作方法

系统的列表操作方法不加赘述,这里增添一些列表操作技巧:

1、利用sum函数把多元列表变成一元:

>>> texts_filtered_stopwords
[['writing', 'ii', 'rhetorical', 'composing', 'rhetorical', 'composing'], ['engages', 'series', 'interactive', 'reading'], ['research', 'composing', 'activities', 'along', 'assignments', 'designed', 'help']]
>>> all_stems = sum(texts_filtered_stopwords,[])
>>> all_stems
['writing', 'ii', 'rhetorical', 'composing', 'rhetorical', 'composing', 'engages', 'series', 'interactive', 'reading', 'research', 'composing', 'activities', 'along', 'assignments', 'designed', 'help']

 

posted @ 2018-01-28 23:04  嶙羽  阅读(174)  评论(0编辑  收藏  举报