15.04.2013 Views

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Finally, we are going to do blank lines intelligently. We will display one blank line when we see one in<br />

the article, but if there are more than one consecutive blank, we only show the first blank line of the set.<br />

Only lines with real data are counted toward the "first 20 lines," so it is possible to display a maximum<br />

of 39 lines of output, 20 real lines of data interleaved with 19 blank ones.<br />

If no errors occur when we run our script, we may see something like this:<br />

$ getLatestNNTP.py<br />

*** Connected to host "your.nntp.server"<br />

*** Found newsgroup "comp.lang.python"<br />

*** Found last article (#471526):<br />

From: "Gerard Flanagan" <br />

Subject: Re: Generate a sequence of random numbers that sum up to 1?<br />

Date: Sat Apr 22 10:48:20 CEST 2006<br />

*** First (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!