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']
人生苦短,何不用python