Stop loop in Python when a file has been modified -
i've filename myfile.txt , want simple script tells me when file has been modified. i'm using os.stat(file).st_mtime see if has been modified. if time has changed, file has been modified.
how can use os.stat(file).st_mtime in while loop this?
while file hasnt been modified: print "file not modified" print "the file has been modified" thanks in advance.
something like
mtime = os.stat(file).st_mtime while os.stat(file).st_mtime == mtime: print "file not modified" print "the file has been modified"
Comments
Post a Comment