Keyboard input

时间:2014-05-01 19:23:26   收藏:0   阅读:392

Keyboard input

Python provides a build-in function called raw_input (in version 2.x) that gets input from the keyboard. In Python 3.x we use input(). When this function is called, the program stops and waits for the user to type something. When the user presses Return or Enter, the program resumes and input() returns what the user typed as a string.

mamicode.com,码迷                       

Before calling input(), it is a good idea to print a prompt telling the user what to input. input() takes a prompt as an argument:

 mamicode.com,码迷

 

from Thinking in Python

 

Keyboard input,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!