使用Python 2.7从JSON API提取数据
这是我的php代码 php代码运行良好使用Python 2.7从JSON API提取数据,python,json,Python,Json,这是我的php代码 php代码运行良好 $json = file_get_contents('http://examole.com/api.php'); $obj = json_decode($json,true); foreach($obj as $row) { echo ( $row["first_name"] ); echo "<br>"; } 在您的示例中,您没有使用从JSON文本加载的对象。 你应该试试这个 data = result.get
$json = file_get_contents('http://examole.com/api.php');
$obj = json_decode($json,true);
foreach($obj as $row)
{
echo ( $row["first_name"] );
echo "<br>";
}
在您的示例中,您没有使用从JSON文本加载的对象。 你应该试试这个
data = result.get("first_name").get("data")
有什么问题?还附加一个示例JSON,您正在尝试解析Python文件not work i get IOError:[Errno socket error][Errno 110]连接超时此错误然后如何解决此问题存在一些问题
data = result.get("first_name").get("data")