I want to read an array of integers from single line of input in python3. For example: Read this array to a variable/list
1 3 5 7 9
Edit: After using Python for almost 4 years, just stumbled back on this answer and realized that the accepted answer is a much better solution.
Same can be achieved using list comprehensions:
Here is example on ideone:
arr = [int(i) for i in input().split()]
If you are using Python 2, you should use raw_input()
instead.