expyriment.io.InputFile

class expyriment.io.InputFile(filename, encoding=None)

A class implementing an input file.

Methods

__init__(filename, encoding=None)

Create an input file.

All lines in the specified text file will be read into a list of strings.

Parameters :

filename : str, optional

name of the input file

encoding : str, optional

the encoding used to read the content of the file

current_line

Getter for current_line.

filename

Getter for filename.

get_line(line=None)

Get a specific line.

If no line is given, the current line will be returned and the value of current_line will be increased by one. First line is line 1.

Parameters :

line : int, optional

number of the line to get

Returns :

line : str

line as string or None if line does not exist

lines

Getter for lines.

logging

Getter for logging.

n_lines

Getter for n_lines.

set_logging(onoff)

Set logging of this object on or off

Parameters :

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

Previous topic

expyriment.io.GamePad

Next topic

expyriment.io.Keyboard

This Page