python - Why does lxml.etree automatically add plus?
学习ing
学习ing 2017-06-22 11:52:40
0
1
710

I am learning lxml, the code is as follows:

from lxml import etree text = '''  

洋鼹鼠

电子商务 天津

''' html = etree.HTML(text) print(etree.tostring(html,encoding='utf-8').decode('utf-8'))

The output is as follows:

 

洋鼹鼠

电子商务 天津

Mainly I don’t understand why there is an error in thetag? How to solve this problem? Thank you~

学习ing
学习ing

reply all (1)
Ty80

Mainly because

p element
Content classification Flow content, palpable content.
Allowed content Phrasing content.
Allowed parent elements Any element that accepts flow content

i Element
Content catergories Flow content, phrasing content, palpable content.
Allowance phrasing content.

Obviously the parent element of the P element should be of flow content type, but i does not meet the conditions, which means it does not comply with the specification.
The solution is to replace i directly with p.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!