String replacement on a whole text file in Python 3.x?
        Posted  
        
            by SkippyFire
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by SkippyFire
        
        
        
        Published on 2010-06-02T20:55:44Z
        Indexed on 
            2010/06/02
            21:34 UTC
        
        
        Read the original article
        Hit count: 285
        
How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way?
I'm thinking that I could read the whole thing into memory, but I'm looking for a more elegant solution...
Thanks in advance
© Stack Overflow or respective owner