Python fileinput Functions

EditRocket provides the following information on fileinput functions in the Python source code builder.

close() - Close the sequence.

filelineno() - Return the line number in the current file.

filename() - Return the name of the file currently being read.

fileno() - Return the integer ``file descriptor'' for the current file.

hook_compressed(filename, mode) - Transparently opens files compressed with gzip and bzip2 (recognized by the extensions '.

hook_encoded(encoding) - Returns a hook which opens each file with codecs.

input([files[, inplace[, backup[, mode[, openhook]]]]]) - Create an instance of the FileInput class.

isfirstline() - Returns true if the line just read is the first line of its file, otherwise returns false.

isstdin() - Returns true if the last line was read from sys.

lineno() - Return the cumulative line number of the line that has just been read.

nextfile() - Close the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count.