No such file or directory: ‘./xx/oo.jj’
要创建文件,需要先创建文件夹。
本语义下
import os
if not os.path.exists('./xx'):
os.mkdir('./xx')
with open('./xx/oo.jj', mode='w') as f:
f.write('sth')
# 成功创建
No such file or directory: ‘./xx/oo.jj’
要创建文件,需要先创建文件夹。
本语义下
import os
if not os.path.exists('./xx'):
os.mkdir('./xx')
with open('./xx/oo.jj', mode='w') as f:
f.write('sth')
# 成功创建