Open this example in the interactive library
Source code
from tempfile import TemporaryDirectory
from pathlib import Path
with TemporaryDirectory() as folder:
p = Path(folder) / 'note.txt'
p.write_text('hello café', encoding='utf-8')
print(p.read_text(encoding='utf-8'))Sample output
hello café
