Skip to main content

Module text

Module text 

Source
Expand description

Delimited text: .txt and .csv.

The format everyone has and nobody specified. A scanner, a script or a colleague hands over a file of numbers with one point per line, and the only things that vary are the delimiter and whether the first line names the columns or is already data.

Both are decided by looking, and neither is guessed at more than once. read_text takes the delimiter from the first line that holds data and reads the whole file with it, rather than re-deciding per line — a file whose separator changes half way through is a broken file, and reading it anyway would turn a diagnosable error into silently wrong coordinates.

write_text writes three numbers a line and nothing else: no header, because a header is the part most likely to make another tool refuse the file, and the reader here does not need one.

Functions§

read_text
Reads a cloud from a delimited text file.
write_text
Writes a cloud as one point a line.