Python 设置标题标签';s string attribute清除BeautifulSoup中另一个标记的string属性

Python 设置标题标签';s string attribute清除BeautifulSoup中另一个标记的string属性,python,beautifulsoup,Python,Beautifulsoup,我尝试使用BeautifulSoup更改一些html文档的标题标记,代码如下: >>> doc = BeautifulSoup(open(filename)) >>> root = doc.find('html') # works only with html parser >>> hafta = root.find(id="hafta") >>> content = hafta.find('div', {'class':'

我尝试使用BeautifulSoup更改一些html文档的标题标记,代码如下:

>>> doc = BeautifulSoup(open(filename))
>>> root = doc.find('html') # works only with html parser
>>> hafta = root.find(id="hafta")
>>> content = hafta.find('div', {'class':'convHtml'})
>>> content.find('b').string
u'BAKANLARA N\u0130\xc7\u0130N KURBAN KES\u0130L\u0130R?'
>>> doc.title.string = content.find('b').string
>>> content.find('b').string
>>>  

奇怪的是,语句
doc.title.string=content.find('b').string
清除了
content.find('b')
中的字符串。为什么会发生这种情况?

这是一个问题。我已经提交了一个修复程序,将在下一个版本中发布。

您能将
文件名所引用的HTML源文档发布到某个地方吗?很高兴知道它很快就会被修复:)