This script provides a class called LineIterator that iterates over every line in a list of files, performing the basic functionality as fileinput module in the standard librarne in a list of files, performing the basic functionality as fileinput module in the standard library (which mimics Perl’s <> operator). Basically acts as a simple and methodical way to iterate over every line in a list of files. If no files are specified at instance creation, then sys.argv[1:] is used. If that is empty, then sys.stdin is used.sys.stdin can be specified in the list of files by listing ‘-’ as a file.

Lacking functionality, compared to the fileinput module, is in-place editing and subsequently backup. The module functions that are included in fileinput are left out here for space concerns. readline() has also been left out since the generator can just have its .next() method called. the gene;
Download from: Homepage




Author:
admin
Time:
Friday, May 9th, 2008 at 8:06 pm
Category:
File Management
Comments:
You can leave a response, or trackback from your own site.
RSS:
You can follow any responses to this entry through the RSS 2.0 feed.
Navigation:

Leave a Reply