我在从下面的元组列表中获取文本列表时遇到了很大的挑战,这是我从 nltk 库中获取的关键字
[('supreme court justice ruth bader ginsburg may', 14.0),
('justice ruth bader ginsburg rightly holds', 12.0),
('vintage ruth— ‘ straight ahead', 10.0),
('fellow supreme court colleagues penned', 10.0),
('could make things better', 8.0),
('neighbor sanford greenberg says', 8.0),
('live. ” ginsburg ’', 8.0),]
Run Code Online (Sandbox Code Playgroud)
这是我想得到的预期输出
['supreme court justice ruth bader ginsburg may',
'justice ruth bader ginsburg rightly holds',
'vintage ruth— ‘ straight ahead',
'fellow supreme court colleagues penned',
'could make things better',
'neighbor sanford greenberg says',
'live. ” ginsburg ’']
Run Code Online (Sandbox Code Playgroud)
谢谢
小智 5
使用索引
a=[('supreme court justice ruth bader ginsburg may', 14.0),
('justice ruth bader ginsburg rightly holds', 12.0),
('vintage ruth— ‘ straight ahead', 10.0),
('fellow supreme court colleagues penned', 10.0),
('could make things better', 8.0),
('neighbor sanford greenberg says', 8.0),
('live. ” ginsburg ’', 8.0),]
a=[x[0] for x in a]
print(a)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27 次 |
| 最近记录: |