1
我刮这个网站www.soundkartell.de
,并且我面临着一些问题的Unicode:的Python 2.7.x - unicode的问题
results =[]
for article in soup.find_all('article'):
if article.select('a[href*="alternative"]'):
artist = article.h2.text
results.append(artist.encode('latin1').decode("utf-8"))
print artist # Din vän Skuggan
print results # [u'Din v\xe4n Skuggan']
我有-*- coding: utf-8 -*-
在我的文件的顶部。
为什么python打印正确的数据而不是附加的数据?
我该如何解决unicode问题?
我使用Python 2.7.x
另外,'de'是Deutschland(即德国)的国家代码。丹麦是'dk'。 –