摘要: package main import ( "fmt" "github.com/antchfx/htmlquery" "net/http" ) func main() { var url string = "https://www.baidu.com/" client := &http.Client 阅读全文
posted @ 2021-11-23 16:23 brady-wang 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 普通的get请求 package main import ( "io/ioutil" "fmt" "net/http" ) func main() { res,_ :=http.Get("https://www.baidu.com/") defer res.Body.Close() body,_ : 阅读全文
posted @ 2021-11-23 16:16 brady-wang 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 从切片中删除元素 Go语言中并没有删除切片元素的专用方法,我们可以使用切片本身的特性来删除元素。 代码如下: func main() { // 从切片中删除元素 a := []int{30, 31, 32, 33, 34, 35, 36, 37} // 要删除索引为2的元素 a = append(a 阅读全文
posted @ 2021-11-23 13:48 brady-wang 阅读(470) 评论(0) 推荐(0) 编辑