I have been having a great challenge in getting a list of text from the list of tuples below, which are the keywords I get from nltk library
[('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),]
This is the expected output i want to get
['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 ’']
Thank you
use indexing
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.