This example does not create the file if it does not exist, but is otherwise the same:
import os os.utime(filename, None) # uses current time os.utime(filename, (atime, mtime))
(PHP 4, PHP 5)
touch — Sets access and modification time of file
bool touch ( string $filename [, int $time= time() [, int $atime ]] )
Attempts to set the access and modification times of the file named in the filename parameter to the value given in time . Note that the access time is always modified, regardless of the number of parameters.
If the file does not exist, it will be created.
Returns TRUE on success or FALSE on failure.
Example #1 touch() example
Example #2 touch() using the time parameter
Prior to PHP 5.3.0 it was not possible to change the modification time of a directory with this function under Windows.