python特殊符号怎么打_Python显示特殊字符

我知道有很多关于这个问题的线索,但我没有找到一个解决我的问题。

我试图打印一个字符串,但打印时它不显示特殊字符(例如æ,ø,å,è和è)。当我使用repr()打印字符串时,得到的是:

u'Von D\xc3\xbc'和u'\xc3\x96berg'

有人知道我如何把它转换成Von Dü和Öberg?对我来说,重要的是不能忽略这些字符,例如myStr.encode("ascii", "ignore")。

编辑

这是我使用的代码。我用美女组刮网站。表(

soup = BeautifulSoup(web)

tables = soup.find_all("table")

scene_tables = [2, 3, 6, 7, 10]

scene_index = 0

# Iterate over the

for scene_table in scene_tables:

i = 0

# Iterate over < td> to find time and name

for td in tables[scene_table].find_all("td"):

if i % 2 == 0: # td contains the time

time = remove_whitespace(td.get_text())

else: # td contains the name

name = remove_whitespace(td.get_text()) # This is the variable containing "nonsense"

print "%s: %s" % (time, name,)

i += 1

scene_index += 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值