Last active
September 21, 2018 03:12
-
-
Save kimdwkimdw/c919f13db45a545590f3 to your computer and use it in GitHub Desktop.
Learn crawling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
how to crawl data? | |
''' | |
base_url = "https://www.sw.or.kr/intro/i_imm_list.jsp?searchType=&searchKeyword=&page=1&pageSize=2000&areaDvsn=&funcClsf=&bsnsType=&indtClsf=" | |
import urllib2 | |
from HTMLParser import HTMLParser | |
parser = HTMLParser() | |
import codecs | |
ll = urllib2.urlopen(base_url).read() | |
l2 = ll.split("</a></td>")[1:] | |
with codecs.open("names.txt","w","utf-8") as fw: | |
for item in l2: | |
fw.write(parser.unescape(item.split("</td>")[0].split("<td>")[1]) + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment