SEARCH
TOOLBOX
LANGUAGES
Python

Python

From Chaehyun

(Difference between revisions)
Jump to: navigation, search
(unicode로 출력된 string 변환)
(pyquery 설치)
 
(One intermediate revision not shown)
Line 6: Line 6:
* unicode_html = myfile.read().decode('utf-8', 'ignore')
* unicode_html = myfile.read().decode('utf-8', 'ignore')
* soup = BeautifulSoup (unicode_html)
* soup = BeautifulSoup (unicode_html)
 +
 +
== pyquery 설치 ==
 +
* easy_install pyquery
 +
* pip install pyquery
 +
* 오류가 발생하면
 +
** apt-get install libxml2-dev libxslt-dev
 +
** apt-get install python-lxml
 +
* 이걸 미리 해줘야함
 +
** apt-get install libxml2-dev
 +
** apt-get install libxslt-dev

Latest revision as of 08:29, 31 January 2013

unicode로 출력된 string 변환

  • print word.decode('unicode_escape')

beautifulsoup 사용할 때

  • encoding 을 알고 있을 때 깔끔하게 정리하기
  • unicode_html = myfile.read().decode('utf-8', 'ignore')
  • soup = BeautifulSoup (unicode_html)

pyquery 설치

  • easy_install pyquery
  • pip install pyquery
  • 오류가 발생하면
    • apt-get install libxml2-dev libxslt-dev
    • apt-get install python-lxml
  • 이걸 미리 해줘야함
    • apt-get install libxml2-dev
    • apt-get install libxslt-dev
Retrieved from "http://chaehyun.kr/w/Python"