摘要: Golang - Gin框架 Gin是一个用 Go语言编写的 web框架。它是一个类似于 martini 但拥有更好性能的API框架, 由于使用了 httprouter,速度提高了近40倍。 如果你是性能和高效的追求者, 你会爱上Gin。 一、创建工程 我们使用 Goland来完成 Gin框架的实例 阅读全文
posted @ 2021-07-25 17:53 vosoland 阅读(72) 评论(0) 推荐(0)
摘要: Go语言标准库 - template 一、模板与渲染 在一些前后端不分离的 Web架构中,我们通常需要在后端将一些数据渲染到 HTML文档中,从而实现动态的网页(网页的布局和样式大致一样,但展示的内容并不一样)效果。 我们这里说的模板可以理解为事先定义好的 HTML文档文件,模板渲染的作用机制可以简 阅读全文
posted @ 2021-07-25 17:52 vosoland 阅读(162) 评论(0) 推荐(0)
摘要: 一、读写锁(hello.go) package main import ( "fmt" "sync" "time" ) var ( x int64 wg sync.WaitGroup rwlck sync.RWMutex //读写锁类型变量 ) func write() { defer wg.Don 阅读全文
posted @ 2021-07-22 13:01 vosoland 阅读(202) 评论(0) 推荐(0)
摘要: 1 package main 2 3 /* 使用goroutine和channel实现一个计算int64随机数各位数和的程序 4 1.开启一个goroutine循环生成int64类型的随机数,发送到jobChan 5 2.开启24个goroutine从jobChan中取出随机数计算各位数的和,将结果 阅读全文
posted @ 2021-07-20 13:19 vosoland 阅读(77) 评论(0) 推荐(0)
摘要: main.py (主程序) 1 from bs4 import BeautifulSoup 2 import urllib.request 3 import urllib.parse 4 import sqlite3 5 import setting 6 import func 7 import t 阅读全文
posted @ 2021-04-23 16:38 vosoland 阅读(185) 评论(0) 推荐(0)
摘要: func.py (定义函数) 1 from bs4 import BeautifulSoup 2 import urllib.request 3 import urllib.parse 4 import sqlite3 5 import setting 6 import time 7 import 阅读全文
posted @ 2021-04-23 16:37 vosoland 阅读(228) 评论(0) 推荐(0)
摘要: setting.py (用于定义各种变量) 1 from bs4 import BeautifulSoup 2 import urllib.request 3 import urllib.parse 4 import sqlite3 5 import func 6 import time 7 imp 阅读全文
posted @ 2021-04-23 16:36 vosoland 阅读(103) 评论(0) 推荐(0)
摘要: 1 from bs4 import BeautifulSoup 2 import urllib.request 3 import urllib.parse 4 import urllib.error 5 import sqlite3 6 import xlwt 7 import re 8 impor 阅读全文
posted @ 2021-04-17 16:22 vosoland 阅读(133) 评论(0) 推荐(0)
摘要: 1 def save_database(para_datalist, para_dbpath): 2 conn = sqlite3.connect(para_dbpath) 3 c = conn.cursor() 4 5 for data in para_datalist: 6 for index 阅读全文
posted @ 2021-04-17 15:48 vosoland 阅读(86) 评论(0) 推荐(0)
摘要: 1 from bs4 import BeautifulSoup 2 import urllib.request 3 import urllib.parse 4 import urllib.error 5 import xlwt 6 import re 7 8 9 # Excel文件保存路径 10 s 阅读全文
posted @ 2021-04-17 10:30 vosoland 阅读(121) 评论(0) 推荐(0)