reading and writing files features provided by the fileinput module include return the name of the file currently being read return the integer "file descriptorfor the current file return the cumulative line number of the line that has just been read return the line number in the current file before the first line has been read this returns boolean function that indicates if the current line just read is the first line of its file some of these are illustrated belowwith fileinput input(files=('textfile txt''textfile txt')as fline readline(print(' filename():' filename()print(' isfirstline():' isfirstline()print(' lineno():' lineno()print(' filelineno():' filelineno()for line in fprint(lineend='' renaming files file can be renamed using the os rename(function this function takes two argumentsthe current filename and the new filename it is part of the python os module which provides methods that can be used to perform range of file-processing operations (such as renaming fileto use the moduleyou will first need to import it an example of using the rename function is given belowimport os os rename('myfileoriginalname txt',myfilenewname txt' deleting files file can be deleted using the os remove(method this method deletes the file specified by the filename passed to it againit is part of the os module and therefore this must be imported firstimport os os remove('somefilename txt'