Go 的 HTML/XML 解析库 goquery

码农软件 · 软件分类 · HTML解析器 · 2019-04-02 22:59:16

软件介绍

goquery是一个使用go语言写成的HTML解析库,可以让你像jQuery那样的方式来操作DOM文档。下面是示例:

func ExampleScrape_MetalReview() {
  // Load the HTML document (in real use, the type would be *goquery.Document)
  var doc *Document
  var e error

  if doc, e = NewDocument("http://metalreview.com"); e != nil {
    panic(e.Error())
  }

  // Find the review items (the type of the Selection would be *goquery.Selection)
  doc.Find(".slider-row:nth-child(1) .slider-item").Each(func(i int, s *Selection) {
    var band, title string
    var score float64

    // For each item found, get the band, title and score, and print it
    band = s.Find("strong").Text()
    title = s.Find("em").Text()
    if score, e = strconv.ParseFloat(s.Find(".score").Text(), 64); e != nil {
      // Not a valid float, ignore score
      fmt.Printf("Review %d: %s - %s.\n", i, band, title)
    } else {
      // Print all, including score
      fmt.Printf("Review %d: %s - %s (%2.1f).\n", i, band, title, score)
    }
  })

本文地址:https://codercto.com/soft/d/2735.html

神经网络与机器学习(原书第3版)

神经网络与机器学习(原书第3版)

[加] Simon Haykin / 申富饶、徐烨、郑俊、晁静 / 机械工业出版社 / 2011-3 / 79.00元

神经网络是计算智能和机器学习的重要分支,在诸多领域都取得了很大的成功。在众多神经网络著作中,影响最为广泛的是Simon Haykin的《神经网络原理》(第3版更名为《神经网络与机器学习》)。在本书中,作者结合近年来神经网络和机器学习的最新进展,从理论和实际应用出发,全面、系统地介绍了神经网络的基本模型、方法和技术,并将神经网络和机器学习有机地结合在一起。 本书不但注重对数学分析方法和理论的探......一起来看看 《神经网络与机器学习(原书第3版)》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试