2020
12-16
12-16
Go Println和Printf的区别详解
Println和Printf都是fmt包中公共方法;在需要打印信息时常用的函数,那么二函数有什么区别呢?附上代码packagemainimport("time""fmt")const(Man=1Female=2)funcmain(){timer:=time.Now().Unix()if(timer%Female==0){fmt.Println("%disFemale",timer)fmt.Printf("%disFemale",timer)}else{fmt.Println("%disMan",timer)fmt.Printf("%disMan",timer)}}运行结果:%disMan1529049077...
继续阅读 >