SEARCH
TOOLBOX
LANGUAGES
Python

Python

From Chaehyun

(Difference between revisions)
Jump to: navigation, search
(unicode로 출력된 string 변환)
(beautifulsoup 사용할 때)
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

Revision as of 05:33, 26 December 2012

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
Retrieved from "http://chaehyun.kr/w/Python"