Jun-29-2018, 07:44 AM
I have tried to convert a Url link which contains XML file to JSON but unable to do it.
import urllib2 import json import xmltodict response.xml = urllib2.urlopen('https://www.openhub.net/projects.xml?api_key=xxxxxxx') with open("response.xml",'r') as f: xmlString = f.read() jsonString = json.dumps(xmltodict.parse(xmlString), indent=4) print(jsonString)This is the code I have used. I am getting the following error.
Error:import module error:No module named 'urllib2'