right, one thing i couldnt find about is feeding input directly into an int array
i've tried
inp = raw_input("Enter input").split(",")
doesn't do much but to print a single string without any separation
advice very welcomed
asked Oct 24, 2014 at 8:43
snejkatamie007
111 silver badge4 bronze badges
1 Answer 1
You could use map:
inp = raw_input('Enter input: ')
ints = map(int, inp.split(','))
Example
>>> inp = raw_input('Enter input: ')
Enter input: 5,4,3,2,1
>>> map(int, inp.split(','))
[5, 4, 3, 2, 1]
answered Oct 24, 2014 at 8:46
enrico.bacis
31.9k10 gold badges90 silver badges116 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py