2015年10月28日 星期三

[python] BeautifulSoup 出現亂碼

http://stackoverflow.com/questions/7219361/python-and-beautifulsoup-encoding-issues url = "http://ocg.xpg.jp/search/search.fcgi?CardNo=1Record=1" res = requests.get(url, verify=False) content = res.content soup = BeautifulSoup(content.decode('Shift_JIS','ignore')) titlename = soup.find('title').string print titlename

沒有留言:

張貼留言