<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="0.92">
<channel>
	<title>Dryice Liu's Blog</title>
	<link>http://dryice.name/blog</link>
	<description></description>
	<lastBuildDate>Tue, 31 Aug 2010 12:01:11 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>challenge 6, continued</title>
		<description>A year has passed since I visited Python Challenge the last time. And it's not easy to start it again :) I've got a project that deals with Python image process, so I spend some time on the PIL handbook. And after that, I think trying this challenge is a ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-6-continued/</link>
			</item>
	<item>
		<title>Challenge 5</title>
		<description>Well this is not an easy one.

The unpickling is as easy as it should:


import pickle

f = open("banner.p", "r")
x = pickle.load(f)
But after that I was lost. x is a list of lists, with 23 items, each item are constructed with one or more tuples, each tuple has two elements: one " ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-5/</link>
			</item>
	<item>
		<title>Challenge 6</title>
		<description>Well first I need to figure out what to zip. I took a look at the HTML source again and found something unusual: the hint looks like:


&#60;html&#62; &#60;!-- &#60;-- zip --&#62;


There's an extra "&#60;—" in the HTML comment. I believe this is pointing me what to zip. But after I ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-6/</link>
			</item>
	<item>
		<title>Challenge 4</title>
		<description>Following the idea yesterday, here is my first script:


import urllib;
import string;
import re;

def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search("[0-9]{5}", pagecontent)
if result:
num = pagecontent[result.start():result.end()]
nexturl = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=" + num
followNothing(nexturl)
else:
print "fix the script!"
and I got:


In [12]: followNothing("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345")
and the next nothing is 92512
and the next nothing is 64505
&#60;font color=red&#62;Your hands are getting tired &#60;/font&#62;and the next ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-4/</link>
			</item>
	<item>
		<title>Challenge 3</title>
		<description>Well, it said EXACTLY three big bodyguard, so the first try is like this:


import re

target = re.compile(r"[!A-Z][A-Z]{3}([a-z])[A-Z]{3}[!A-Z]")

f = open("mess.txt", "r")

myout = target.findall(f.read())
And I got this:


In [7]: print myout
['e', 'i', 'z', 'r', 'v', 'g', 'b', 'm', 's', 'z', 'u', 'o', 'w', 'i', 'b', 'z', 'b', 'c', 'j', 'g', 'd', 'o', 'h', ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-3/</link>
			</item>
	<item>
		<title>Challenge 2</title>
		<description>First of all I checked the lib to see if there's an OCR module, looks no, at least not in the standard distribution :)

OK, it says to find the rare chars, so here is my first try:


f = open("mess.txt", "r")

ss = {}

for c in f.read():
if ss.has_key(c):
ss[c] += 1
else:
ss[c]=1
And here is ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-2/</link>
			</item>
	<item>
		<title>Challenge 1</title>
		<description>After staring at the mess sentence at the end for a while, I realize there's not too mucy "k,o,e" in it so the idea yesterday won't work.

Look again at the pic and I think I found what's in it: int(k)+2 = m, int(o)+2 = q, int(e)+2 = g. I think ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-1/</link>
			</item>
	<item>
		<title>Challenge 0</title>
		<description>OK, this is marked as "warming up" so it should be easy.

The hint is "look at the URL address.". OK, this is challenge 0 and the url is 0.html. So I changed it to 1.html.

There is a page there! It shows "2**38 is much much larger.". OK I know what ...</description>
		<link>http://dryice.name/blog/python/python_challenge/challenge-0/</link>
			</item>
</channel>
</rss>

