我已经将json数据加载到api_result变量。现在我需要提取特定的字段(name,surname,city等)。我应该如何确认他们是否在那里? api_result = json.loads(some_json_data)
if api_result.get('name'):
# do something with name
if api_result.get('surname
我(主要是试图学习python和json,而且)试图定期从twitter推出和格式化热门话题列表。我一起拼凑了许多不同的教程。它服务于我的目的 - 打印我需要标准输出的HTML,但我想知道如果我可以考虑不同的对象或更好地构造它。助攻? class trend:
#these are the fields that Twitter provides, so they make up on