In the dictionary hosted at https://gist.github.com/extratone/06d20b5c10ca528a6c7266f1e1b8d623, how could I extract only the values of "full_text"
To extract only the values of the "full_text" key from the dictionary hosted at https://gist.github.com/extratone/06d20b5c10ca528a6c7266f1e1b8d623, you can use the following Python code:
import json
with open("twitter-data.json") as file:
data = json.load(file)
full_text_list = [tweet["full_text"] for tweet in data]
print(full_text_list)
This code reads the JSON data from the file "twitter-data.json" and loads it into the data
variable as a Python dictionary. It then creates a new list called full_text_list
by iterating over each tweet in the data
dictionary and appending the value of its "full_text" key to the list. Finally, it prints the full_text_list
to the console.
Note that you will need to replace "twitter-data.json" with the name of the file that contains the JSON data in your local directory.