Wrapping long lines

Fernando Pérez fperez528 at yahoo.com
Sun Oct 20 20:06:13 EDT 2002


Will Stuyvesant wrote:

> Sometimes they send me a file, for me to read, and it has very long
> lines.  Their editor--from--hell just puts a whole paragraph into one
> line!  Recognize the problem?
> 
> So here is yet another python newbie script for yet another silly
> problem.

Nothing wrong with reinventing the wheel, it's good practice and teaches a 
lot. But I'm sure you've heard of `fmt` and its ilk for this problem. For 
fancier stuff where fmt isn't enough, pr typically can do the job.

$ fmt nasty_file | less

is often all you need.

Cheers,

f.



More information about the Python-list mailing list