Create empty file using python [duplicate]

I’d like to create a file with path x using python. I’ve been using os.system(y) where y = 'touch %s' % (x). I’ve looked for a non-directory version of os.mkdir, but I haven’t been able to find anything. Is there a tool like this to create a file without opening it, or using system or popen/subprocess?

2 Answers
2

Leave a Comment