Old Paranoia Game in Python

mensanator at aol.com mensanator at aol.com
Sun Jan 9 23:51:16 EST 2005


Paul McGuire wrote:
> <mensanator at aol.com> wrote in message
> news:1105318366.966577.107460 at c13g2000cwb.googlegroups.com...
> >
> > Aahz wrote:
> > > Trust the computer, the computer is your friend.
> >
> > However, the computer isn't a fuckin' mind reader.
> >
> > If you're going to post source code on the usenet, don't
> > have lines longer than 72 characters. Otherwise you'll
> > find your code has wrapped lines. This not only causes
> > syntax errors in your choose and print statements but
> > also fucks up the formatting of of printed paragraphs.
> >
> > Stupid human.
> >
>
> I copy-and-pasted to a file named para1.py, then wrote the
> following python script with pyparsing to fix the erroneous
> line breaks.
>
> -- Paul
>
> ===============================
> from pyparsing import *
>
> extraLineBreak = White(" ",exact=1) + LineEnd().suppress()
> text = file("para1.py").read()
> newtext = extraLineBreak.transformString(text)
> file("para2.py","w").write(newtext)
Damn, that was pretty neat! You learn something new every day.




More information about the Python-list mailing list