python input
时间: 2023-10-27 17:51:56 浏览: 34
input与raw_input-python学习
Python input() function is used to read input from the user. It reads input as a string and can be assigned to a variable for further processing. Syntax of the input() function is:
input([prompt])
Here, prompt is an optional argument which can be used to display a message to the user before taking input. If prompt is not specified, the function will wait for the user to enter input without any message.
Example:
name = input("Enter your name: ")
print("Hello, " + name)
Output:
Enter your name: John
Hello, John
阅读全文