reason :
Check the code carefully , The reason is that the file to be created The directory does not exist .
namely : To create a /a/b/c/d.txt, You need to guarantee /a/b/c Directory exists .
The code first detects whether the directory exists , If it does not exist, create a multi-level directory first :
if not os.path.exists(prefix_dir):
os.makedirs(prefix_dir)
attach :
Create multi-level directory :os.makedirs()
Create directory :os.mkdir()
create a file :os.mknod()