Created
January 23, 2025 20:21
-
-
Save harsh317/1deeab8b2a3d96734abb0580bd54aba1 to your computer and use it in GitHub Desktop.
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 | |
# Creating a file | |
file = Path("example.txt") | |
file.write_text("Hello, Pathlib!") | |
# Reading the file | |
print(file.read_text()) | |
# Checking existence | |
if file.exists(): | |
print("File exists") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment