In [1]:
import os

In [2]:
os.makedirs('temp/dir', exist_ok=True)

In [3]:
with open('temp/012.txt', 'w') as f:
    pass

In [4]:
with open('temp/abc.txt', 'w') as f:
    pass

In [5]:
with open('temp/file.text', 'w') as f:
    pass

In [6]:
with open('temp/dir/789.txt', 'w') as f:
    pass

In [7]:
with open('temp/dir/xyz.text', 'w') as f:
    pass