Thursday , February 22 2018
Home / Python / Python raw_input read input from keyboard

Python raw_input read input from keyboard

In this tutorials I am going to show you how to read input from keyboard in python.

Python raw_input :

Python raw_input is a python function used to read the input from keyboard in the form of String.

raw_input() Example :

x=raw_input("Enter any value : ")
print x
print type(x)

If we use raw_input() function, what ever the type of data you have given as an input it will internally converted as String type only. We can check the type of data using type(x) function.

Note : The raw_input() function has been deprecated in python 3.x instead we can use python input() function.

Lets run the above sample code :

$ python
Enter any value : chandra
<type ‘str’>
$ python
Enter any value : 1234
<type ‘str’>
$ python
Enter any value : 1.235
<type ‘str’>

Happy Learning 🙂

About chandrashekhar

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,


Convert any Number to Python Binary Number

We have discussed in the previous tutorials, how to handle different types of number systems …

Leave a Reply

Your email address will not be published. Required fields are marked *