Drkcore

13 01 2011 Python Tweet

beautifulsoupでJGPの電車ダイアグラムを取ってくる

ちょっと必要になったので

import urllib2,os
from BeautifulSoup import BeautifulSoup
url = "http://oreilly.com/javascript/excerpts/javascript-good-parts/syntax-diagrams.html"

soup = BeautifulSoup(urllib2.urlopen(url).read())

for _img in soup.findAll('img'):
    if 'excerpts' in _img.get('src'):
        img_url = _img.get('src')
        with open(os.path.basename(img_url), 'wb') as f:
            f.write(urllib2.urlopen(img_url).read())

宣伝

来月、コミュニテイf@富士でJavascript The Good Partsの読書会があります。

ProductName JavaScript: The Good Parts ―「良いパーツ」によるベストプラクティス
Douglas Crockford
オライリージャパン / 1890円 ( 2008-12-22 )


About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021