get_line_col

get_line_col(filename, skip_line=0, skip_col=0, seek=0, encoding='ascii')

Get a value at specific line/columns coordinates.

Parameters:

filename : str

The name of the file that will be parsed

skip_line : int, default=0

Number of lines skipped If skip_line < 0: count lines backward from the end of the file. Be careful: a last empty line is taken into account too! Default: 0: no line skipped

skip_col : int, default=0

Number of columns skipped from the beginning or end of the line. If skip_col < 0: count col backward from the end of the line. Default: 0: no column skipped

seek : int, default=0

if > 0, consider the file starts at pos seek. if < 0, consider the file ends at pos -seek (and NOT (end-(-seek))!). Default: 0: consider the whole file.

encoding : str

Returns:

result : float

Value to retrieve

Examples

>>> import openturns.coupling_tools as otct
>>> with open('results.out', 'w') as f:
...     count = f.write('1.1 1.2 1.3 1.4')
>>> otct.get_line_col(filename='results.out', skip_col=2)
1.3