I am currently using the urllib to load a url request and then I load the response to json. This works perfectly but when I change the date range one field contains the \n character and is breaking the line.
How would I stop this from happening I have tried replace and rstrip but can't seem to get them to work.
Here is my code that extracts the data:
req = urllib.request.Request("http://example.com/file.json")
r = urllib.request.urlopen(req).read()
#r = r.rstrip('\n')
content = json.loads(r.decode('utf-8'))
#content.replace('\n','') - fails due to incorrect type
Thanks