2021
10-12
10-12
golang fmt格式“占位符”的实例用法详解
golang的fmt包实现了格式化I/O函数,类似于C的printf和scanf。#定义示例类型和变量typeHumanstruct{Namestring}varpeople=Human{Name:"zhangsan"}普通占位符占位符说明举例输出%v相应值的默认格式。Printf("%v",people){zhangsan},%+v打印结构体时,会添加字段名Printf("%+v",people){Name:zhangsan}%#v相应值的Go语法表示Printf("#v",people)main.Human{Name:"zhangsan"}%T相应值的类型的Go语...
继续阅读 >