79201248

Date: 2024-11-18 19:55:20
Score: 2
Natty:
Report link

Encode your character string first to utf-8:

str = "éé Ñ".encode("utf-8")
with open("file.txt", "wb") as f:
f.write(b"Hello, World!\r\n")
f.write(str)

with open("file.txt", "r", encoding="utf-8") as f:
for i, line in enumerate():
print(i, line)

https://realpython.com/python-encodings-guide/

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: leafdude