I have a simple piece of code that breaks my mind:
if __name__ == '__main__':
writen_text = chr(13)
file = open('bug', 'w')
file.write(writen_text)
file.close()
file = open('bug')
read_text = ''.join(file.readlines())
print([ord(c) for c in writen_text])
print([ord(c) for c in read_text])
assert writen_text == read_text
The output is
[13]
[10]
Traceback (most recent call last):
File "/bug.py", line 10, in <module>
assert writen_text == read_text
AssertionError
What is this??? I just want to write a text to a file and read exactly this text without any changes
Python3.6.6, Ubuntu18.04, if it matters