I am trying to solve problems from SPOJ. I need to be able to read input from stdin for that, I did a lot of problems in C using scanf but wanted to try Python as well. How do i read the stdin inputs in Python? (wanna use Python 2.6/2.7)
Asked
Active
Viewed 2,024 times
2 Answers
5
In Python 2.7
To get integers or floats as inputs you can use the key word 'input' Example: temp=input("Give your value") Here temp only takes a float or int
There is another command raw_input() any value that raw input is given it converts it to string and assigns the value Example:temp=raw_input("Give your value") Here temp is of string type

Pradeep Kumar Nalluri
- 135
- 2
- 9
0
For what I researched, in python 2.7(in all versions of python 2) the command of input is: raw_input( )
in this link have a tutorial about this: https://linuxconfig.org/how-to-obtain-an-user-input-with-python-raw-input-function-example