1. 程式人生 > >python 讀取數據接口 ip 字段插入本地文件

python 讀取數據接口 ip 字段插入本地文件

imp 讀取數據 python http ESS mdb htm pad write

#!/usr/bin/pythonimport urllib2import urllibimport jsonweatherHtml = urllib.urlopen('http://172.17.37.93:1949/machine/select') weatherHtml1 = weatherHtml.read() weatherJSON = json.loads(weatherHtml1) print weatherJSONout=open('/root/cmdb_ip','w') for i in weatherJSON["data"]: abc = i['privateIpAddress'] + "\n" for key in abc: out.write(key)


python 讀取數據接口 ip 字段插入本地文件