NLP之路-python爬虫

解决了IDE中文显示的问题,通过print(soup.head.title).encode('gb18030')解决了中文路径无法打开的问题。

通过file=open(u"D:/users/nancy/share/sae6depart/6系资料/python/crawl.txt","w")。

import urllib
from urllib import urlopen
c=urllib.urlopen("http://www.baidu.com")
contents=c.read()
print(contents[0:50])
from bs4 import BeautifulSoup
soup=BeautifulSoup(urlopen("http://www.baidu.com"))
print(soup.head.title).encode('gb18030')
file=open(u"D:/users/nancy/share/sae6depart/6系资料/python/crawl.txt","w") 


好了现在开始正式的=================================================================

首先,主要参考物:

http://download.csdn.net/detail/u012365383/6986983 (Python自然语言处理)

http://www.cnblogs.com/elaron/p/3213333.html (网络爬虫 )

http://www.cnblogs.com/elaron/archive/2013/09/04/3301973.html (文本挖掘 )





你可能感兴趣的:(原创,NLP,小技术,Python)