Python data input

First, the plurality of character strings input line

  1, among a plurality of strings with a comma interval

  

A, B, C = INPUT ( ' three strings: ' ) .split ( ' , ' )

  2, among the plurality of strings separated by spaces apart

A, B, C = INPUT ( ' three strings: ' ) .split ()

 

Second, a plurality of digital input line

  1, a plurality of integers between spaced apart by commas

  

A, B, C = the eval (INPUT ( ' three numbers: ' ))

  2, a plurality of integers between spaced apart by spaces

A, B, C = Map (the eval, INPUT ( ' three numbers: ' ) .split ())

Here map input data must be at least two data

 

Third, a plurality of data output line

print(a,b,c)

 

# # Plurality of sets of input and output of a + b and 
the while . 1 : 
    A, B = Map (int, INPUT () Split ().)
     IF a + b == 0:
         BREAK ;
     Print (a + b)

 

Note that  input () is the input data type of the default string type, if the target data to be accepted is an integer, you can consider the data type conversion

Input = A () # # Jifukushi 
a = int (a)

 

Guess you like

Origin www.cnblogs.com/-citywall123/p/11545328.html
Recommended