[Solved] How to create an array from an ascii file with python [closed]


input = """3 5 2 1 3 
4 2 3 4 2
2 1 3
2 1 8 7"""

f = [int(i) for i in input.split()]
A = tuple(f)

The value of A is now:

(3, 5, 2, 1, 3, 4, 2, 3, 4, 2, 2, 1, 3, 2, 1, 8, 7)

Important note: This is not an array, this is a tuple. Also, this will only work (because of the int(i)) if all of your input is integers.

solved How to create an array from an ascii file with python [closed]