my Setting.txt
:
mode = spam
def read_setting():
try :
setting = open("Setting.txt","r")
mode = setting.readline().split(" ")[2]
print("Mode: "+mode)
return str(mode)
except:
print("There is/are error in Setting.txt
Please check if you have the file / correct the file formatting")
exit()
The func returns spam
(confirmed this by manual debugging and its returns what i want) ,
But at my main program ,
def intro():
print("This is just a print
")
def main():
intro()
moded = read_setting()
if moded == "spam":
timer()
elif moded == "paste":
paste()
if __name__ == '__main__':
main()
the func timer()
does not run
it turns out, when i do print(moded=="spam")
, it returns False
What am i wrong here?
My Python:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
question from:
https://stackoverflow.com/questions/65856858/why-returns-does-not-match-with-string 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…