Quote:
Originally Posted by Crow
Won't work, since "log" is your list of lines, not the file handle. Instead:
PHP Code:
f = open("rclog.txt",'r') log = f.readlines() f.close()
|
After a bit of research,
PHP Code:
log = open('rclog.txt','r').readlines()
Will automatic close the file descriptor (handle) once the python garbage collector finds it.
Its better to explicitly use a variable handle, or a with-block but since its a small script that will only be ran once in a while, it doesn't really matter.
For bigger projects though, you would need to close it.