I’m trying to replace all single quotes with double quotes, but leave behind all escaped single quotes. Does anyone know a simple way to do this with python regexs?
Input:
"{ 'name': 'Skrillex', 'Genre':'Dubstep', 'Bass': 'Heavy', 'thoughts': 'this\'s ahmazing'}"
output:
"{ "name": "Skrillex", "Genre": "Dubstep", "Bass": "Heavy", "thoughts": "this\'s ahmazing"}"
This is kind of…odd, but it may work. Remember to preface your string with
rto denote a raw string so that we can remove the backslashes:The
REPLACEMEOHYEAHthe token to replace, so it would need to be something that is not going to appear in your actual string. The response format looks like something that could be parsed in more natural way, but if that isn’t an option this should work.