Apr-10-2020, 08:43 AM
Hello dear users, let me explain you my problem with variable.
b = open("test.txt", "r").readline()
a = input("Write")
if a == b:
print("good")
I have really simple program like this. In my "test.txt" i have only two lines and in first is "a" and in second "b"
If i put in my input "a" this if statement not work and not print "good". But when only try to print out print(b) it prints "a" so i do not understand why it is not working.
My variable b is equal to "a" but my if statement says it is not equal.
I also noticed when i have only one line in my notepad then it is working. So please guys can you help me with this ? Why it is not working when i have two lines in notepad.
Thank you a lot !
b = open("test.txt", "r").readline()
a = input("Write")
if a == b:
print("good")
I have really simple program like this. In my "test.txt" i have only two lines and in first is "a" and in second "b"
If i put in my input "a" this if statement not work and not print "good". But when only try to print out print(b) it prints "a" so i do not understand why it is not working.
My variable b is equal to "a" but my if statement says it is not equal.
I also noticed when i have only one line in my notepad then it is working. So please guys can you help me with this ? Why it is not working when i have two lines in notepad.
Thank you a lot !
My github:
https://github.com/Samuel-Bachorik
https://github.com/Samuel-Bachorik