I'm importing from a .txt file containing some David Foster Wallace that I copy-pasted from a PDF. Some words ran off the page and so come in the form of
"interr- upted"
I was going to sanitize it by using something like:
with open(text, "r", 0) as bookFile:
bookString = bookFile.read().replace("- ", "")
Except... the man also uses some weird constructions in his writing. Things like:
"R - - d©"
for the brand name bug spray Raid©. I'm left with "R d©" obviously, but is there a way to make it .replace() instances of "- " but not instances of " - "? Or do I need to turn everything into lists and do operations to everything that way? Thanks.