Implement touch using Python?

touch is a Unix utility that sets the modification and access times of files to the current time of day. If the file doesn’t exist, it is created with default permissions.

How would you implement it as a Python function? Try to be cross platform and complete.

(Current Google results for “python touch file” are not that great, but point to os.utime.)

15 Answers
15

Leave a Comment