Python program input and output (input () / print () / eval ())

input and output functions python

1. The input function input ()

Get the function of user input from the console

input () function using the format:

<Variable> = input (<message string>)

User-entered information stored in the character string type <variable>, for example:

TempStr = input ( "Enter") #TempStr save variables entered by the user

2. Output function print ()

Function output in characters to the console

print () function using the format:

print (<analog output string or string variable>)

String type of quotation marks only within the program uses no output quotes

3. The evaluation function eval ()

eval () using the format:

the eval ( expression The [, Globals [, about locals ]])

expression The - Expression

globals - variable scope, global namespace, if provided, it must be a dictionary object

locals - variable scope, the local name space, if provided, may be any map object

Here are some of the eval () function usage :

 

Guess you like

Origin www.cnblogs.com/cyt99/p/11855538.html