Input summary in Python 2
1.raw_input (prompt = none) with input (prompt = none)
Two are the default parameter types, which can be passed in a string that is used for input when output, such as
1 # Well, your name is really a good movie . 2 your_name = input (" your name is?") ")
Input assumes that the user entered a valid Python expression , and therefore tries to evaluate the expression, input first calls Raw_input to get the original input, and then calls Eval to get the value of the input expression, and if the expression is illegal, an error is thrown. The specific error depends on the input.
In the official documentation for Python 2, there is one sentence: Consider using the Raw_input () function for general input from users. Therefore, unless specifically required, the raw_input of Python 2 should be used primarily as a generic interactive input.
The return type of Raw_input () is a string, and we can combine a function such as int (), float () to convert the string to the format we want
about how to view documents
On Linux, we can type
Pydoc Raw_input
To get a document about Raw_input, and press Q to exit
On Windows, we type
Python-m Pydoc Raw_input
You can get the document without pressing Q to exit
Python Input Summary