Home > Article > Development Tools > How to use input in sublime
The input() function of Sublime Text is used to prompt user input in the editor. The usage is as follows: input(prompt): displays the prompt text and obtains user input. Parameters: prompt is the text that prompts the user to enter. Return value: Returns the string entered by the user, or None when input is cancelled.
Usage of Input in Sublime Text
input()
function in Sublime Text Used to prompt user input in the editor. It displays different input prompt boxes based on the parameters passed in.
Usage:
<code>input(prompt)</code>
Where:
Return value:
input()
The function returns the text value entered by the user. If the user cancels the input, it returns None
.
Type:
input()
The prompt text type of the function is string, and the returned value type is string or None
.
Example:
<code># 提示用户输入名称 name = input("请输入您的姓名:") # 打印用户输入的名称 print("您的姓名是:", name)</code>
Note:
input()
function will Pauses program execution at the current cursor position until the user enters and presses the Enter key. Esc
key), the input()
function will return None
. \n
line breaks in the prompt text. input()
The function cannot be used directly to obtain input from the command line. You need to use sublime.run_command()
to execute the command. The above is the detailed content of How to use input in sublime. For more information, please follow other related articles on the PHP Chinese website!