[Numpy-discussion] fromfile() for reading text (one more time!)

Pauli Virtanen pav@iki...
Sat Jan 9 06:44:03 CST 2010


pe, 2010-01-08 kello 15:12 -0800, Christopher Barker kirjoitti:
> 1) optionally allow newlines to serve as a delimiter, so large tables 
> can be read.

I don't really like handling newlines specially. For instance, I could
have data like

	1, 2, 3;
	4, 5, 6;
	7, 8, 9;

Allowing an "alternative separator" would sound better to me. The above
data could then be read like

	fromfile('foo.txt', sep=' , ', sep2=' ; ')

or perhaps

	fromfile('foo.txt', sep=[' , ', ' ; '])

Since whitespace matches also newlines, this would work.

	Pauli





More information about the NumPy-Discussion mailing list