Efficient_Python_tricks_and_tools_for_data_scientists
Efficient_Python_tricks_and_tools_for_data_scientists copied to clipboard
Issue on page /Chapter2/pathlib.html
the pathlib example seems odd/incorrect, returning 12?
to make it similar to the os example perhaps it should be the following?
from pathlib import Path
# Create a new directory
folder = Path("new")
folder.mkdir(exist_ok=True)
# Create new file inside new directory
file = folder / "new_file.txt"
# Write text
file.write_text("Hello World!")
# Read text
print(file.read_text())
with a result of:
Hello World!