[Tutor] how to check if a file is being used by another person or application before writing to it?

R. Alan Monroe amonroe at columbus.rr.com
Tue Nov 30 23:53:27 CET 2004


> similarly is there a way to check if a file has been written to? I

One way would be the last modified date. Check out os.path.getmtime()


> suppose I would do something like periodically check the size of a
> particular file and if it increased then I would know it was written

This is probably less reliable than the date, but os.path.getsize()
will tell you the file size.

Alan



More information about the Tutor mailing list