How to read two inputs separated by space in a single line?

Solution 1:

Like this:

In [20]: a,b = raw_input().split()
12 12.2

In [21]: a = int(a)
Out[21]: 12

In [22]: b = float(b)
Out[22]: 12.2

You can't do this in a one-liner (or at least not without some super duper extra hackz0r skills -- or semicolons), but python is not made for one-liners.

Solution 2:

One liner :)

>>> [f(i) for f,i in zip((int, float), raw_input().split())]
1 1.2
[1, 1.2]

Solution 3:

Simpler one liner(but less secure):

map(eval, raw_input().split())

Solution 4:

If the input is separated by spaces " "

a,b,c = raw_input().split(" ")

If the input is separated by comma ','

a,b,c = raw_input().split(",")