2010年2月19日金曜日

twitmateのデータを作ったときのスクリプト

このエントリーをブックマークに追加 このエントリーを含むはてなブックマーク
かきすてでも読めるレベルになるのがpythonのいいところ。
http://king-soukutu.com/twit/?n=twitmate
http://king-soukutu.com/twit/?n=twitmate2

import re
user = re.compile(r'"http://twitter.com/(?P[A-Za-z0-9_+]+)"')

m = user.search('"http://twitter.com/pothos"')
#print m.group()

found = {}
for i in range(1, 31):
  f = open('following%i.html'%(i))
  lines = f.read()
  ms = user.findall(lines)
  for m in ms:
    found[m] = 'http://twitter.com/%s'%(m,)
  f.close()
for u in found:
  print u

0 件のコメント: