"Jay Mutter III" <[EMAIL PROTECTED]> wrote

> The following is what I put in (interactively) and what I got out.
>
> >>> ss = open('inp.txt')
> >>> s = ss.read()
> >>> s.replace('p. ','\n')
> 'Barnett, John B., assignor of one-half to R. N. Tutt, Kansas City,
> Mo. Automatic display-sign.\xc2\xa0 \xc2\xa0 No. 1,330 411-Apr. 13 ;
> v. 273 ;\xc2\xa0\n\n193. Barnett,\xc2\xa0 John\xc2\xa0 II..\xc2\xa0

Try using print s.replace()

You are getting caught with the difference between repr() and str()
Python uses repr when evaluating an expression at the >>> prompt
but uses str() when using print. Try:

>>> print 'here are lines\nof text'
>>> repr ('here are lines\nof text')

> I though about treating it as a list of lines, stripping carriage
> returns on the basis of some criteria but i have never gotten rstrip
> to work

Strange, what happens? rstrip() is pretty simple!

HTH,

Alan G 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to