Suggestions for how to approach this problem?

Necmettin Begiter necmettin.begiter at gmail.com
Tue May 8 16:10:39 EDT 2007


On Tuesday 08 May 2007 22:23:31 John Salerno wrote:
> John Salerno wrote:
> > typed, there are often line breaks at the end of each line
>
> Also, there are sometimes tabs used to indent the subsequent lines of
> citation, but I assume with that I can just replace the tab with a space.

Is this how the text looks like:

123
some information

124 some other information

126(tab here)something else

If this is the case (the numbers are at the beginning, and after the numbers 
there is either a newline or a tab, the logic might be this simple:

get the numbers at the beginning of the line. Check for \n and \t after the 
number, if either exists, remove them or replace them with a space or 
whatever you prefer, and there you have it. Also, how are the records 
seperated? By empty lines? If so, \n\n is an empty line in a string, like 
this:
"""
some text here\n
\n
some other text here\n
"""



More information about the Python-list mailing list