A version of touch() for Python3.2; use now as time
This commit is contained in:
parent
de07b9d4f1
commit
c28c49ba67
@ -76,7 +76,7 @@ def touch(fname, mode=0o666, dir_fd=None, **kwargs):
|
||||
## After http://stackoverflow.com/questions/1158076/implement-touch-using-python
|
||||
if sys.version_info < (3, 3, 0):
|
||||
with open(fname, 'a'):
|
||||
os.utime(fname, times)
|
||||
os.utime(fname, None) # set to now
|
||||
else:
|
||||
flags = os.O_CREAT | os.O_APPEND
|
||||
with os.fdopen(os.open(fname, flags=flags, mode=mode, dir_fd=dir_fd)) as f:
|
||||
|
Loading…
x
Reference in New Issue
Block a user