<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A little programming project &#8211; part 3</title>
	<atom:link href="http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/</link>
	<description>Writings on technology and society from Wellington, New Zealand</description>
	<lastBuildDate>Wed, 02 May 2012 08:16:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: colin</title>
		<link>http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/comment-page-1/#comment-1139</link>
		<dc:creator>colin</dc:creator>
		<pubDate>Mon, 27 Oct 2008 08:44:27 +0000</pubDate>
		<guid isPermaLink="false">http://it.gen.nz/?p=300#comment-1139</guid>
		<description>Lawrence

You&#039;re completely right about the spare &quot;links&quot; line. And also, of course, about the way I chose to implement getting a web page - I know that a file object is created, but I&#039;m not interested in it and I&#039;m delighted to let Python clean it up for me. All I want is the contents of the web page in a form I can manipulate.

Cheers

Colin</description>
		<content:encoded><![CDATA[<p>Lawrence</p>
<p>You&#8217;re completely right about the spare &#8220;links&#8221; line. And also, of course, about the way I chose to implement getting a web page &#8211; I know that a file object is created, but I&#8217;m not interested in it and I&#8217;m delighted to let Python clean it up for me. All I want is the contents of the web page in a form I can manipulate.</p>
<p>Cheers</p>
<p>Colin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence D'Oliveiro</title>
		<link>http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/comment-page-1/#comment-1123</link>
		<dc:creator>Lawrence D'Oliveiro</dc:creator>
		<pubDate>Fri, 24 Oct 2008 22:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://it.gen.nz/?p=300#comment-1123</guid>
		<description>One subtlety worth mentioning: in the line

    page = urllib.urlopen(linkspage).read()

the urllib.urlopen call is returning a file object; you call this read() method to obtain the contents, then discard the object, whereupon Python&#039;s memory management will automatically close it. May horrify some people used to having to explicitly close every file they open, but it works!</description>
		<content:encoded><![CDATA[<p>One subtlety worth mentioning: in the line</p>
<p>    page = urllib.urlopen(linkspage).read()</p>
<p>the urllib.urlopen call is returning a file object; you call this read() method to obtain the contents, then discard the object, whereupon Python&#8217;s memory management will automatically close it. May horrify some people used to having to explicitly close every file they open, but it works!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence D'Oliveiro</title>
		<link>http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/comment-page-1/#comment-1122</link>
		<dc:creator>Lawrence D'Oliveiro</dc:creator>
		<pubDate>Fri, 24 Oct 2008 22:24:12 +0000</pubDate>
		<guid isPermaLink="false">http://it.gen.nz/?p=300#comment-1122</guid>
		<description>It&#039;s amazing what a little bit of Python can do.

Just a stylistic matter, I would prefer to write the while-loop as follows:

    while True :
        page = urllib.urlopen(linkspage).read()
        links = re.findall(r&#039;&quot;http\S*?echnology\S*?&quot;&#039;,page)
        if len(links) &gt;= 2 :
            break
        time.sleep(60)

saves checking len(links) twice. Also you have a line that just says

    links

which I don&#039;t think is doing anything useful, and can be removed.</description>
		<content:encoded><![CDATA[<p>It&#8217;s amazing what a little bit of Python can do.</p>
<p>Just a stylistic matter, I would prefer to write the while-loop as follows:</p>
<p>    while True :<br />
        page = urllib.urlopen(linkspage).read()<br />
        links = re.findall(r&#8217;&#8221;http\S*?echnology\S*?&#8221;&#8216;,page)<br />
        if len(links) &gt;= 2 :<br />
            break<br />
        time.sleep(60)</p>
<p>saves checking len(links) twice. Also you have a line that just says</p>
<p>    links</p>
<p>which I don&#8217;t think is doing anything useful, and can be removed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eugene</title>
		<link>http://it.gen.nz/2008/10/19/a-little-programming-project-part-3/comment-page-1/#comment-1113</link>
		<dc:creator>Eugene</dc:creator>
		<pubDate>Tue, 21 Oct 2008 23:23:13 +0000</pubDate>
		<guid isPermaLink="false">http://it.gen.nz/?p=300#comment-1113</guid>
		<description>I am seaching for some idea to write in my blog... somehow come to your blog. best of luck. Eugene</description>
		<content:encoded><![CDATA[<p>I am seaching for some idea to write in my blog&#8230; somehow come to your blog. best of luck. Eugene</p>
]]></content:encoded>
	</item>
</channel>
</rss>

