(Jan-28-2019, 05:39 PM)greektranslator Wrote: Right, thanks, how do I define the file on which the replacements will run?
To my knowledge, a txt file open in this way runs within the python environment, thus not opening any external editors. I'm still a newbie myself. But I've been working on a project that deals with txt editing. It's been my experience that no external editors (notepad, notepad++, gedit, vim, etc.) opens when you run
with open() as f:
. Beyond that, what you're doing with the for loop, is beyond my knowledge. If I were you, I'd make a smaller test txt file and run some experiments before running it on the real thing.Scratch that, I reread your post.
To define the file that you are editing, that is the part in the quotes. So think about it this way:
with open("C:\\absolute\\path\\to\\file.txt") as f