访问用户数据
我们想了解的许多 Twitter 数据都存储在子 JSON 对象中。我们将通过 user 子 JSON 对象访问用户信息的多个部分。
上一个练习中的 tweet 已为您加载。
本练习是课程的一部分
在 Python 中分析社交媒体数据
练习说明
- 使用键
screen_name打印用户的用户名(handle)。 - 使用键
followers_count打印用户的粉丝数。 - 使用键
location打印用户自定义的位置。 - 使用键
description打印用户自定义的简介。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Print user handle
print(tweet[____][____])
# Print user follower count
print(tweet[____][____])
# Print user location
print(tweet[____][____])
# Print user description
print(tweet[____][____])