For Linux users.
If you don’t need atomicity you can use os module:
import os
if not os.path.exists('/tmp/test'):
os.mknod('/tmp/test')
macOS and Windows users.
On macOS for using os.mknod() you need root permissions.
On Windows there is no os.mknod() method.
So as an alternative, you may use open() instead of os.mknod()
import os
if not os.path.exists('/tmp/test'):
with open('/tmp/test', 'w'): pass