Iterating through large file like objects

Iterating through large file-like objects 1.1

Iterating through large file-like objects 1.1 Download Summary

  • Language: Python
  • Platform: Windows / Linux / Mac OS / BSD / Solaris
  • License: Other Free / Open Source License - Python License
  • Databases: N/A
  • Downloads: 430
  • Released: Jun 6, 2007

Iterating through large file-like objects 1.1 Description

This function provides a simple iterator for the lines of a file-like object. (It also provides a flag for removing/retaining trailing newlines.)

I ran into the problem a number of times that I wanted to read-in a very large file-like object (say a GB or two) line by line. This is a problem for any object that wants to read the entire "file" in at once, unless you have several GB of memory just begging to be used...

In Python 2.3, while file objects now support this sort of single-line iteration, not all file-like objects do. For example, using the for-in construction with sys.stdin still causes sys.stdin to read in everything before the for-loop begins iteration. Using the iterfile function allows you to process sys.stdin iteratively, which may be important if you have a lot of information coming in on standard input.

Iterating through large file-like objects 1.1 Keywords

Iterating through large file like objects Bookmark

Hyperlink code:
Hyperlink for Forum code:

Iterating through large file-like objects 1.1 Script Download Notice

Top 4 Download periodically updates information of Iterating through large file-like objects 1.1 script from the developer, but some information may be slightly out-of-date.

Our script download links are directly from our mirrors or publisher's website. Iterating through large file-like objects 1.1 torrent files or shared files from free file sharing and free upload services, including Rapidshare, MegaUpload, YouSendIt, MailBigFile, DropSend, HellShare, HotFile, FileServe, MediaMax, zUpload, MyOtherDrive, SendSpace, DepositFiles, Letitbit, LeapFile, DivShare or MediaFire, are not allowed!

Directory Iterator

This script is an iterator that can be used to walk through directories.This class is intended to provide an iterator version of the os.listdir function. The interesting property of the iterator is that you can control if you want ... having returned the path of a directory, the iterator will yield the content of this directory if ...
Python

Decorator

... decorating the function, calls it, passing it a file object that it had opened as the first argument.Of course, it makes sure to close the file upon the function's return (or nonreturn) with a ... very convenient macro called with-open-file that opens a file, binds the file object to a block-local variable, ...
Python

File Subclass

If the 'file' object looks for a '.filename.pkl' file which contains the seek offset of the previous end of the file, then this subclass sets the seek offset to that number before returning the file.On closing the file or StopIteration, it writes the new max offset to this pickle file. ...
Python

z directory

... a memory-based directory copier and paster. Pickled Directory objects will contain all data from a directory at ... can be saved in other locations.Once a Directory object has been created, pasting it to another location is ex has beenimple. ...
Python

Cross Platform Excel Parsing With Xlrd

This script easily extract data from microsoft excel files using this wrapper class for xlrd. The class ... for easily pulling in a variety of excel files without having to deal with COM calls or ... have windows. Data is extracted by creating a iterator object which can be used to return data ...
Python