I\'m new to python and I\'m trying to scan multiple numbers separated by spaces (let\'s assume \'1 2 3\' as an example) in a single line and add it to a list of int. I did i
these will both work in Python 2.7 and Python 3.x:
>>> l = [1, 2, 3] >>> print(' '.join(str(x) for x in l)) 1 2 3 >>> print(' '.join(map(str, l))) 1 2 3
btw, array is a reserved word in Python.
array