Tagged with " python"

No Thumbnail

IP -> Location

GeoLite City vs GeoIP City: GeoLite City GeoIP City Cost Free $370 initial, $90 per month updates Coverage Worldwide Worldwide [...]

May 25, 2009     No Comments
Read More
No Thumbnail

Python unescape javascript escapped UTF8 sequence

尋找這種答案很浪費生命,記錄下來 print "".join([(len(i)>0 and unichr(int(i,16)) or "") for i in url.split('%u')])

Mar 16, 2008     No Comments
Read More
No Thumbnail

簡體 UTF8 -> 繁體/正體 UTF8

Encode-CNmap 是好朋友 雖然字表沒有完整,但是大部份都有轉換成功,而且使用上也不錯簡單 轉換文字檔案: cnmap -u2cb5 utf8.txt > utf8-cntrad.txt 對於懶得在 Python 下面 implement 繁簡轉換的人(me?)實在很好用: import commands s = commands.getoutput("echo '简体中文' [...]

Mar 15, 2008     1 Comment
Read More
No Thumbnail

Python-pycurl Note

import pycurl c = pycurl.Curl() c.setopt(pycurl.URL, "http://blog.tarotoast.com/") import StringIO b = StringIO.StringIO() c.setopt(pycurl.WRITEFUNCTION, b.write) c.setopt(pycurl.USERAGENT, "Mozilla/4.0 (compatible; MSIE 7.0; Windows [...]

Mar 15, 2008     No Comments
Read More