regex - How do I JSON_encode a dictionary in python? -


value = re.findall(b,'some regex',respdata) keywords = re.findall(b,'some regex',respdata)  #empty dictionary dictionary = {} x=0 eachvalue in value:         dictionary[eachvalue] = keyword[x]         x+=1         print(dictionary) 

after this, want json encode dictionary in "value:keyword" format, suggestions on how this? thank in advance

python has module json:

value = re.findall('some regex',respdata) keywords = re.findall('some regex',respdata) print json.dumps(dict(zip(value, keywords))) 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -