package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
)
func ExampleScrape() {
doc, err := goquery.NewDocument("http://www.weather.com.cn/weather1d/101180101.shtml")
if err != nil {
fmt.Errorf("when create from reader error %s ", err.Error())
}
// Find the review items
dic := doc.Selection.Find("div.t").Html()
fmt.Println(dic + "cnm")
}
func main() {
ExampleScrape()
}
报错:multiple-value doc.Selection.Find("div.t").Html() in single-value context
我想获取下那个节点的html内容,老报错,
更多评论
```
dic,_ := doc.Selection.Find("div.t").Html()
fmt.Println(dic + "cnm")
```
人家返回两个值,你接收的时候,就要全部接收.要用不到,就用_.
#1