How to read formatted input in python?
- by eSKay
I want to read from stdin five numbers entered as follows:
3, 4, 5, 1, 8
into seperate variables a,b,c,d & e.
How do I do this in python?
I tried this:
import string
a=input()
b=a.split(', ')
for two integers, but it does not work. I get:
Traceback (most recent call last):
File "C:\Users\Desktop\comb.py", line 3, in <module>
b=a.split(', ')
AttributeError: 'tuple' object has no attribute 'split'
How to do this? and suppose I have not a fixed but a variable number n integers. Then?