Created
July 13, 2023 01:09
-
-
Save pFransozi/0297b6839849ef0f38faab07f53bd8c5 to your computer and use it in GitHub Desktop.
py create new dir and file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
folder = Path("new_dir") | |
folder.mkdir(exist_ok=True) | |
file = folder / "new_file.txt" | |
file.write_text("Hello, world") | |
file.read_text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment