2015-11-09から1日間の記事一覧

スクレイピング Python

メモ。 import urllib2 from bs4 import BeautifulSoup html = urllib2.urlopen("http://www.oreilly.co.jp/index.shtml") soup = BeautifulSoup(html,"lxml") list = soup.find_all("a") for i in list: print i.string,i.get("href")

Python で Windows cmd.exe 上でコマンド実行

cmd.exe起動して、python main.py とかして実行. import subprocess for i in range(100): cmd = "dir" subprocess.call(cmd,shell=True) 100回dirされるだけ。 どうやら、 vssadmin list shadows みたいな管理者権限チックなコマンドの場合、動かないときが…