Comment on Why does not a CR (Carriage Return) automatically start a new line on some online text editors?

<- View Parent
historicaldocuments@lemmy.world ⁨1⁩ ⁨week⁩ ago

You could probably get 80% of that process done by learning some python. If you have a string “s”, then replacing double newlines with a single newline is as easy as

re.sub(“\n\n”, “\n”, s)

where “\n” is an LF in many programming languages. A CR is often “\r” in the same vein. Just be aware that regular expressions can be very, very frustrating; and every webpage is going to be a new adventure in how it got formatted. If you use something like spyder it’ll allow you to see what the data looks like inside the python process so you get a chance to iterate.

source
Sort:hotnewtop