Add python text file

1. Add python file package
mkdir + file name

If you are creating a multi-level directory, use os.mkdirs
import os

path = "/pythonProject2/requests_demo/learn"
if not os.path.exists(path):
os.mkdir(path, 777) # If you are creating a multi-layer directory, use os.mkdirs
else:
print("Already exists" )

For more details: check the python input and output blog

Guess you like

Origin blog.csdn.net/weixin_41665637/article/details/109073574