[SciPy-User] Ignore characters while reading text

Florian Lindner mailinglists at xgm.de
Fri Jun 14 06:50:17 EDT 2013


Hello,

I have a text file with data like

1 (2 3 4) (5 6 7) (8 9 10)
2 (4 5 1) (3 6 8) (1 6 45)

How can I read that file into an array?

[
[1, 2, 3, 5, 6, 7, 8, 9, 10]
[2, 4, 1, 3, ... ]
]

I tried genfromtxt with deletechars="()" but that seems to affect only 'names'. 
I also tried delimiter="() " but that didn't work either.

Thanks!

Florian



More information about the SciPy-User mailing list