码迷,mamicode.com
首页 > 编程语言 > 详细

python列表操作方法

时间:2018-01-29 00:27:15      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:stop   series   filter   ext   rac   top   gpo   sum   style   

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

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列表操作方法

标签:stop   series   filter   ext   rac   top   gpo   sum   style   

原文地址:https://www.cnblogs.com/yqpy/p/8372814.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!