关于python的lxml.html 的fromstring 函数

1,使用html.fromString 函数的话,感觉不像是先解析成dom树的,所以无论给的文档是什么,it can always deal it.Sometimes,I delete all the titel , body and html tag,It doesn't matter actually.

2,html.fromstring 会解析html 头部中charset属性,并且自动的decode

3,它只看start 标签,根据正则定位到该字符串出现的位置,然后开始寻找xpath 中下一个路径,所以开始的标签很重要。

原文地址:https://www.cnblogs.com/harveyaot/p/2980363.html