无法输出Russian_Python2.7.9

时间:2015-02-22 11:04:03

标签: python-2.7 encoding character-encoding

我不能用俄语输出只输出Unicode =(

我使用Pythonv.2.7.9 Microsoft 8

我如何用列表做到这一点?

  #! /usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup


r = requests.get("http://fs.to/video/films/group/film_genre/")
response = r.content.decode('utf-8')
page = BeautifulSoup(response)

for tag in page.findAll('li'):
    a = tag.find('a')
    for b in a.contents:
        print (u'{0}'.format(u'○'),unicode(b.string))

输出示例必须如下:

Аниме

Биография

...

Фэнтези

Эротика

1 个答案:

答案 0 :(得分:0)

将最后一行更改为:

print (u'{0}'.format(u'○'),b.string