我的数据格式如下:
[{"user": "fgb59h", "id": 4, "text": 'hello'},
{"user": "bucho_ky", "id": 20, "text": 'why'},
{"user": "redp944", "id": 40, "text": 'this is an example'},
]
我要选择“文本”并将其转换为:
['hello','why','this is an example']
以便我可以对数据进行文本分析。
我应该怎么做?
提前谢谢!
答案 0 :(得分:0)
另一种可能性:
DATA = [{"user": "fgb59h", "id": 4, "text": 'hello'},
{"user": "bucho_ky", "id": 20, "text": 'why'},
{"user": "redp944", "id": 40, "text": 'this is an example'},
]
result = [i['text'] for i in DATA]
print(result)