Learn the basics of file handling in Python, including reading from and writing to files.
Source Code
# Writing to a file
with open("example.txt", "w") as f:
f.write("Hello, file!")
# Reading from a file
with open("example.txt", "r") as f:
content = f.read()
print(content)