If I have a script that writes 1000 lines to file and then continues regular expressions against that file, however only the last 100 lines of text written will be available. One way around this is to close and reopen the file. Is there a way to reload a file after being written to or should I just make a write close open module? It may be relevant that the logfile did not exist/is empty on the first open.
>>> the_page = 'some large site opened through urllib'
>>> logfile = open('./artist/' + tags['ARTIST'], 'r+')
>>> logfile.write(the_page)
>>> print logfile.read()
Nothing appears.
>>> 'Some regular expressions search'
Searches against last 100 lines written.
>>> logfile.close()
>>> logfile = open('./artist/' + tags['ARTIST'], 'r+')
>>> print logfile.read()
Everything appears.
>>> 'Some regular expressions search'
Performs as expected.