import sys
s1 = input()
s2 = sys.stdin.read(1)
#type "s" for example
s1 == "s" #False
s2 == "s" #True
Why? How can I make input() to work properly?
I tried to encode/decode s1, but it doesn’t work.
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re on Windows, you’ll notice that the result of
input()when you type an ‘s’ and Enter is"s\r". Strip all trailing whitespace from the result and you’ll be fine.