存取轉推資料
現在要操作一個包含轉推的推文 JSON。轉推與一般推文的結構相同,但會在 retweeted_status 中再存放一則推文。
新的推文已載入為 rt。
本練習屬於課程
使用 Python 分析社群媒體資料
練習說明
- 印出這則推文的文字。
- 印出被轉推的那則推文文字,內容位於
retweeted_status。 - 印出這則推文的使用者帳號(handle)。
- 印出被轉推的那則推文的使用者帳號(handle),內容位於
retweeted_status。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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[____][____][____])