Extracting data from JSON / dictionary with Python -
i have output :
result = { "sip_domains":{ "prefix":[{"name":""}], "domain":[{"name":"k200.com"},{"name":"zinga.com"},{"name":"rambo.com"}] }, "sip_security":{"level":2}, "sip_trusted_hosts":{"host":[]}, "sip_proxy_mode":{"handle_requests":1} } from wanted output print screen :
domain : k200.com domain : zinga.com domain : rambo.com how can output using regular expression
help needed urgently
if getting data string somewhere must convert python dictionary object access it. should not have use regular expressions output.
import json # json str somehow json_dict = json.loads(json_str) domain_dict in json_dict['sip_domains']['domain']: print 'domain : %s' % (domain_dict['name'])
Comments
Post a Comment