This is somewhat of a simple question and I hate to ask it here, but I can\'t seem the find the answer anywhere else: is it possible to get multiple values from the user in
In Python 2.*
, input
lets the user enter any expression, e.g. a tuple:
>>> a, b = input('Two numbers please (with a comma in between): ')
Two numbers please (with a comma in between): 23, 45
>>> print a, b
23 45
In Python 3.*
, input
is like 2.*
's raw_input
, returning you a string that's just what the user typed (rather than eval
ing it as 2.*
used to do on input
), so you'll have to .split
, and/or eval
, &c but you'll also be MUCH more in control of the whole thing.