[Python] raw_input() function

raw_input() function presents a prompt to the user, get  input from the user and returns the data input by user in a string.

Example:

name = raw_input("What is your name? ")
inputCountry = raw_input("Where are you from? ")
print "You are %s, come from %s." % (name, inputCountry)

print "How tall are you? "
height = raw_input()
print "You are %s tall." % height

Result:

What is your name? Rovingleaves
Where are you from? Taiwan
You are Rovingleaves, come from Taiwan.
How tall are you?
172cm
You are 172cm tall.

留言

這個網誌中的熱門文章

[Golang] for