What does python input mean?

藏色散人
Release: 2019-08-01 15:49:45
Original
31720 people have browsed it

Python is an interpreted, object-oriented, high-level programming language with dynamic data types. Python was invented by Guido van Rossum at the end of 1989, and the first public release was released in 1991. Like the Perl language, Python source code also follows the GPL (GNU General Public License) agreement.

What does python input mean?

#What does python input mean?

The input() function in Python3.x accepts a standard input data and returns it as string type.

In Python2.x, input() is equivalent to eval(raw_input(prompt)), which is used to obtain console input.

raw_input() treats all input as strings and returns the string type. And input() has its own characteristics when dealing with pure numeric input. It returns the type of the entered number (int, float).

Note:

Both the input() and raw_input() functions can receive strings, but raw_input() directly reads the input from the console (any type of input can be take over). As for input(), it hopes to be able to read a legal python expression, that is, you must use quotes to enclose it when you enter a string, otherwise it will raise a SyntaxError.

Unless there is a special need for input(), we generally recommend using raw_input() to interact with users.

Note:

Input() in python3 receives the str type by default.

Function syntax

input([prompt])
Copy after login

Parameter description:

prompt: Prompt message

Related recommendations: "Python Tutorial"

The above is the detailed content of What does python input mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!