Here is my example:
>>> a=input ('some text : ') # value entered is 1,1
>>> print (a)
1,1
I want as a result a tuple (1, 1)
How can I do this?
Here is my example:
>>> a=input ('some text : ') # value entered is 1,1
>>> print (a)
1,1
I want as a result a tuple (1, 1)
How can I do this?
It can be done in the following way.
a = '3, 5, 7, 23'
out = tuple(map(int, a.split(",")))
print(out)
(3, 5, 7, 23)
>>> a = input()
(21, 51, 65, 45, 48, 36, 8)
>>> m = eval(a)
>>> type(m)
<class 'tuple'>