html的片段如下<a id=hello </a>,想获取id对应的值hello,第二行代码可以获取到id的值为hello,但是如何把hello转化为text()或其他格式?
- web=html("<a id=hello </a>")
- web %>% html_nodes(xpath="//a/@id") %>% extract2(1)
- web %>% html_nodes(xpath="//a/@id") %>% extract2(1) %>% html_text()
|
楼主: Maxzo
|
3773
2
[问答] R爬虫rvest获取节点属性XMLAttributeValue转化问题 |
|
小学生 35%
-
|
| ||
|
|
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


