SoFunction
Updated on 2024-11-19

Python input function usage examples

This article introduces the use of Python input function examples, the text of the sample code through the introduction of the very detailed, for everyone's learning or work has a certain reference learning value, the need for friends can refer to the following

function definition

def input(*args, **kwargs): # real signature unknown
  """
  Read a string from standard input. The trailing newline is stripped.
  The prompt string, if given, is printed to standard output without a trailing newline before reading input.
  If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
  On *nix systems, readline is used if available.
  """

function usage

input() Blocking keyboard input, you can add keyboard hints. The return value is always a string. If you need an integer you must force a type conversion.

name = input()  
print(name)
name = input('Please enter a name:') # Blocking
print(name)

This is the whole content of this article.