I'm new to Python and I'm learning about loops and conditions. I have the code:
import random
import sys
import os
test_file = open("test.txt", "wb") #use wb if write
append = ""
while append != "exit":
print("Write something to append to file: ")
append = sys.stdin.readline()
test_file.write(bytes(append, 'UTF-8'))
test_file.close()
Now, whenever I type in 'exit', I would expect it to exit out of the loop, but for some reason, it doesn't. It continues to be what seems like an infinite loop. What could be the reason behind it? Thanks in advance.