[Tutor] Suggestions as to how to read a file in paragraphs

Tzu-Ming Chern T.Chern at unibas.ch
Wed Sep 1 22:56:49 CEST 2004


Hi Alan,

> First, do you need the efficiency? Is it actually causing a problem
> just now?

Before yes, but not now. The efficiency is needed when very large files
are needed and not enough RAM is available to process huge files (eg. >
3 million lines)
 
> Lots of modules might help (re, parser, string, fileinput etc) but
> nothing
> specifically for splitting text files by paragraph. (And how do you
> define a paragraph separator? Is it a blank line or is it an indented
> first line? Both are valid...)

Depending on the biological sequence files, the paragraph separator could
be a "//" or newlines or any string really. I know in perl there is an
input record separator which by default is the newline and one can specify
this to a specific delimiter. Is there one in python?

Apologies for the confusion!

cheers,
tzuming





More information about the Tutor mailing list