本文最后更新于 2 分钟前,文中所描述的信息可能已发生改变。
Pathlib
python
from pathlib import Path
path = Path('path/to/file') # Create a Path object
path.exists(parents=True) # Check if the file exists
path.mkdir(parents=True, exist_ok=True) # Create the directory