Is there a "safe" way to modify HTML with Python, and write it to file again? -


i'm making blog flask/jinja, , i'm storing each blog's html content .json file (for specific needs). noticed when reading html content python with:

with open(filepath, 'r') f:     data = f.read() 

everything looks fine when print original data. however, when modify , extract parts of html using python, of sudden, newlines replaced \n, , ' replaced \' breaks when served html again (or when dumped .json file opened later). know can replace "\n" pretty easily, i'm curious why python that, , if there's "safe" way handle html, edit it, , write out file again?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -