Accesarea datelor unui retweet
Acum vom lucra cu un JSON de tweet care conține un retweet. Un retweet are aceeași structură ca un tweet obișnuit, cu excepția faptului că are un alt tweet stocat în retweeted_status.
Noul tweet a fost încărcat ca rt.
Acest exercițiu face parte din cursul
Analiza datelor din social media în Python
Instrucțiuni pentru exercițiu
- Afișează textul tweet-ului.
- Afișează textul tweet-ului care a fost redistribuit, stocat în
retweeted_status. - Afișează numele de utilizator al tweet-ului.
- Afișează numele de utilizator al tweet-ului care a fost redistribuit, stocat în
retweeted_status.
Exercițiu interactiv practic
Încearcă acest exercițiu completând acest cod de exemplu.
# Print the text of the tweet
print(rt[____])
# Print the text of tweet which has been retweeted
print(rt[____][____])
# Print the user handle of the tweet
print(rt[____][____])
# Print the user handle of the tweet which has been retweeted
print(rt[____][____][____])