Skip to content

read

Syntax

some_list = read(file-name, column-number)
some_list = read(file-name)

Parameters

file-name
The name of comma-separated file. The file-name may include the path to the file.
column-number
The index of the column to be read. Columns are indexed starting with 0. If omitted, 0 is assumed.

Returns

Returns a list of values.

Description

Returns a list of values composed of the values read from one column of a comma-separated file. If the column number is not specified, the first column (column 0) is used.

Empty lines in the file are ignored.

Lines with a non-numeric value in the first column are ignored.

An error occurs if the file is not found, or if the column-number does not exist.

Examples

some_list = read(some_date.csv, 2)  # read in the values in the third column of the file

See Also