当前位置:网站首页>lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
2022-07-05 05:24:00 【Star and Dream Star_ dream】
Python Reptiles Problems encountered in :
Python Code ( There's nothing wrong with it , yes HTML There is a problem with the document )
from lxml import etree # Access to the local HTML file html = etree.parse(r" test .html") result = etree.tostring(html, encoding='utf-8').decode('utf-8') print(result)
HTML file ( Error message )
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>etree Of parse Method </title> </head> <body> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </body> </html>
Solution :
Focus on modifying this part
After modification :
<meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
Add “/” Number
Successful execution :
End
边栏推荐
- Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
- 64 horses, 8 tracks, how many times does it take to find the fastest 4 horses at least
- [merge array] 88 merge two ordered arrays
- Django reports an error when connecting to the database. What is the reason
- PMP candidates, please check the precautions for PMP examination in July
- win10虚拟机集群优化方案
- Simple modal box
- What is the agile proportion of PMP Exam? Dispel doubts
- 使用Electron开发桌面应用
- Haut OJ 1357: lunch question (I) -- high precision multiplication
猜你喜欢
随机推荐
Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
被舆论盯上的蔚来,何时再次“起高楼”?
第六章 数据流建模—课后习题
Es module and commonjs learning notes
YOLOv5添加注意力機制
[allocation problem] 455 Distribute cookies
[轉]: OSGI規範 深入淺出
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
C语言杂谈1
Shell Sort
[trans]: spécification osgi
Use of room database
SDEI初探-透过事务看本质
质量体系建设之路的分分合合
[turn]: OSGi specification in simple terms
[speed pointer] 142 circular linked list II
To the distance we have been looking for -- film review of "flying house journey"
A new micro ORM open source framework
软件测试 -- 0 序
Warning using room database: schema export directory is not provided to the annotation processor so we cannot export