I have millions of JSON objects formated as string with a little text inside. For example:
'{"node": {"text": "Você entra numa livraria de livros jurídicos você tem
uma pilha de livros dizendo: "você pode fazer isso". Ao lado você tem uma
pilha de livros que contestam exatamente isso. Assim são as discussões
sobre a legalidade da flexibilização do porte de armas. Eu examinei bem
profundamente isso porque sou uma defensor da legítima defesa tive mais
tempo que o próprio presidente para observar item a item e o presidente
pode ficar tranquilo!"}}'
I was able to replace the single quotes as double quotes for the JSON module to accept it. But I am experiencing a lot of errors because of double quotes inside the 'text'. I'm trying to write a regex expression to deal with it. The code i wrote replace not only the first double quote, but the ones just after 'text'.
re.sub(r'(:\s+"*)', ' ', text)
How could I write a regex that clean both double quotes from "você pode fazer isso" and keep the ones after 'text' intact?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.