Converting raw_input to input from python 3.0

The raw_input function is not in used after python 3.0 . raw_input function has been replaced by input function.

raw_input function is used for getting user inputs. This function mostly used in python 2.7

Now this function is replaced.

Both input and raw_input functions are belongs to sys package. Therefore sys package should import to your python script.

import sys


See below Example for usage of this function.

 your_input = input ("Please Type Something :")


Not only the raw_input function.

print command also converted into a function. To print something on the python shell, type following command.

print ("Hello World !"); 

0 comments:

Post a Comment

Ask anything about this Tutorial.