go 使用代理ip
摘要: // 设置代理地址 proxyURL, err := url.Parse("http://114.233.71.74:40009") if err != nil { fmt.Println("代理 URL 解析失败:", err) return } // 自定义 Transport 使用代理 tra
15
0
0
go 初始化日志
摘要: var Logger *log.Logger // 初始化日志器 func InitLogger(logFilePath string) { // 打开日志文件 file, err := os.OpenFile(logFilePath, os.O_APPEND|os.O_CREATE|os.O_WR
8
0
0
ubuntu20 安装Go/go go定时任务
摘要: 安装 Go 使用官方包管理器安装(版本可能不是最新): 查看版本: apt list golang // 是1.13版本(太老了),直接从官网下载 sudo apt update sudo apt install -y golang 从官方网站下载安装(推荐,获取最新版本): wget https:
37
0
0
go json
摘要: 在 Go 语言中,当爬虫返回 JSON 数据时,可以通过 encoding/json 包解析 JSON 数据并提取其中的值。以下是两种常见方法来解析 JSON 数据并获取特定字段(如 code)。 示例 JSON 数据 假设你爬取到的 JSON 数据如下: { "code": 200, "messa
27
0
0
go 协程与channel(管道)
摘要: package main import ( "fmt" "io" "log" "net/http" "os" "regexp" "strings" "sync" ) func gomoun(c chan int) { for i := 0; i < 10000; i++ { c <- i } clo
9
0
0
go 正则匹配文本
摘要: func findStr() { testStr := "There are 123 apples and 456 oranges." // 查找所有匹配的子字符串 pattern := `\d+` // 匹配一个或多个数字 re := regexp.MustCompile(pattern) //
10
0
0
go 检测是否包含某一字段
摘要: resp, err := client.Do(req) if err != nil { results <- fmt.Sprintf("Request error: %v", err) return } defer resp.Body.Close() bodyText, err := io.Read
10
0
0
python match用法
摘要: Python 3.10 引入了一个重要的新特性:结构化模式匹配(Structural Pattern Matching),主要通过 match 语句实现。它类似于其他编程语言(如 C、JavaScript、Go)中的 switch-case 语句,但功能更强大,支持更复杂的模式匹配。 基本语法: m
90
0
0
pop() 和 remove()
摘要: pop() 和 remove() 在 Python 中都有移除元素的功能,但它们的使用场景和行为不同: 1. 功能对比 特性 pop() remove() 返回值 移除的元素(或值) 无(直接移除,不返回值) 目标 按索引(列表)或键(字典),或任意元素(集合) 按值移除元素 适用数据类型 列表、字
52
0
0
装饰器1
摘要: def lo_stat(msg=None): print(f"{msg} 启动") def lo_end(msg=None): print(f"{msg} 结束") def decorator(func): def wrapper(): # print("在函数执行之前做点事") lo_stat(f
4
0
0
上一页 1 2 3 4 5 6 ··· 39 下一页
上一页 1 2 3 4 5 6 ··· 39 下一页

本文作者:DIVMonster

本文链接:https://www.cnblogs.com/guangzan/p/12886111.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

点击右上角即可分享
微信分享提示
深色
回顶
收起