标签:read package string golang main tps pack pac print
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
fmt.Println(http.Status)
res, err := http.Get("https://www.baidu.com/")
if err != nil {
fmt.Println("get err:", err)
return
}
data, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println("get data err:", err)
return
}
fmt.Println(string(data))
}
标签:read package string golang main tps pack pac print
原文地址:https://www.cnblogs.com/lajiao/p/10895709.html