Weird behaviour?
jussij at zeusedit.com
jussij at zeusedit.com
Sun Apr 21 20:37:18 EDT 2013
Can someone please explain the following behaviour?
I downloaded and compiled the Python 2.7.2 code base.
I then created this simple c:\temp\test.py macro:
import sys
def main():
print("Please Input 120: ")
input = raw_input()
print("Value Inputed: " + input)
if str(input) == "120":
print("Yes")
else:
print("No")
main()
If I run the macro using the -u (flush buffers) option the if statement always fails:
C:\Temp>python.exe -u c:\temp\test.py
Please Input 120:
120
Value Inputed: 120
No
If I run the macro without the -u option the if statement works as expected:
C:\Temp>python.exe c:\temp\test.py
Please Input 120:
120
Value Inputed: 120
Yes
What's going on?
Cheers Jussi
More information about the Python-list
mailing list