Skip to content
TrackPodcasts
technologyNov 3, 20141:45:28pending

3. 静态网站生成器

内核恐慌

About this episode

动态网站太重了。轻量级的静态网站生成工具一时蔚然成风,至少在开发者圈子里如此。它是什么,解决了怎样的问题,为什么流行,效果如何?

吴涛希望 Rio 转写成 Go 的 Python 代码:

import datetime
print datetime.datetime.now().strftime('北京时间 %H 点 %M 分')

Rio 的回复:

import (
	"fmt"
	"time"
)

func main() {
	fmt.Println(time.Now().Format("北京时间 15 点 04 分"))
}

简单来说,Go 使用「2006」、「Jan」、「2」、「15」、「04」等字面值来代替 strftime 中的「%Y」、「%b」、「%d」、「%H」、「%M」作为格式化日期时的占位符。延伸阅读: Parsing and formatting date/time in Gohttp://golang.org/pkg/time/#pkg-constants

相关链接

Get every episode summarized

Each time 内核恐慌 publishes, we email you a written briefing from the transcript — the topics, who appeared, and any specific claims, with the ad reads skipped.

Email me new episodes

Free for 3 shows. No card needed.

Hosts & guests

No transcript yet

This episode has not been transcribed. Request it and it moves to the front of the queue.

3. 静态网站生成器

内核恐慌

0:00
1:45:28

More episodes

More from 内核恐慌

View all episodes →