2009. 10. 17. 12:36 Programming/Python
BeautifullSoup을 사용한 html 파서
import glob
import os
import os.path
import sys
import urllib
from BeautifulSoup import BeautifulSoup
import pickle
import sgmllib
from pprint import pprint
import re
import MySQLdb
def InsertMovieData(): #file_source = open('photo_unique_keys.htm','r') for tag in soup.findAll('img', width="300"): #file_source.closed db.close() |
def InsertNewsData(httpurl,group): db = MySQLdb.connect(host="121.254.251.82", user="color", passwd="", db="DuplicatedDB", charset='utf8') cursor = db.cursor() html_source = urllib.urlopen(httpurl).read() for tag in soup.findAll('img', width="200"): db.close() |
if __name__ == '__main__':
#InsertMovieData()
InsertNewsData(sys.argv[1], sys.argv[2])
'Programming > Python' 카테고리의 다른 글
Network programming with the Twisted framework, Part 1 (0) | 2010.03.05 |
---|