how to read full file into buff for re using?

Max M maxm at mxm.dk
Thu Mar 21 03:55:21 EST 2002


Zoom Quiet wrote:

> i'm chinese python fresh men; help please!
> how to read full file into buff for re object using?
> such as:
> re.sub()

f = open('file.txt', 'r')
content = f.read()
f.close()

More info her:

http://www.python.org/doc/current/tut/node9.html#SECTION009200000000000000000

> /======================\
> | Time is unimportant;
> | only life important!
> \======================/

But perhaps you should spend your time searching the web then ;-)

http://www.google.com/search?hl=en&q=python+opening+file+read+contents

regards Max M




More information about the Python-list mailing list