I am trying to read from 2 text files (001.txt and temp.txt) and compare the numbers. I am opening the files, reading from them, and using int() to convert the strings to ints. The files only contain a single number, 0 for both in this case. I am getting the error ValueErrorr: invalid literal for int() with base 10: '\ufeff0'
. I have checked the text files and there are no spaces or extra lines. I am not sure what the issue is. Any advice would be much appreciated!
code:
localfile = open("001.txt", "r")
local_num = localfile.read()
tempfile_name = "temp.txt"
tempfile = open(tempfile_name, "r")
if(int(local_num) == int(temp_num)):
print("same")
elif(int(local_num) != int(temp_num)):
print("different")
tempfile.close()
localfile.close()