ClientForm

말 그대로 html 상에 있는 form 을 처리할수 있는 분이다. 아래의 코드를 잠시 보자. 얼마나 간단한가? 이 코드가 할수 있는 일은 정말 막강하다.

ClientForm 을 다운 받은후  “파이썬 루트/Lib\site-packages/ ” 에 ClientForm.py 복사 하시라…

#!/usr/bin/python
# -*- coding: cp949 -*-
from urllib2 import urlopen
from ClientForm 
import ParseResponse
import sys
if len(sys.argv) is 1 :
        print >> sys.stderr , '분석할 URL 을 넣어주세요.'
        exit(1)
response = urlopen(sys.argv[1])
forms = ParseResponse(response)
form = forms[0]
print form

수행 시켜보면 안다.

수행 예 ))  >python form.py  http://www.naver.com/

결과 ))
<GET http://search.naver.com/search.naver application/x-www-form-urlencoded
<SelectControl(where=[*nexearch, web, site, webkr, kin, doc, cafeblog, post, article, dic, …

Read More