分享
Go打印函数printf格式简介
abcijkxyz · · 3292 次点击 · · 开始浏览这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。
fmt.print参数规约
printf输出规约是按照预定义好的参数格式输出的,参数和对应说明如下表所示。
| parameter | description |
|---|---|
| %d | decimal integer |
| %x, %o, %b | integer in hexade cimal, octal, binar y |
| %f, %g, %e | floating-p oint number: 3.141593 3.141592653589793 3.141593e+00 |
| %t | boole an: true or false |
| %c | rune (Unico de co de point) |
| %s | string |
| %q | quoted str ing "abc" or rune ‘c’ |
| %v | any value in a natural format |
| %T | type of any value |
| %% | literal percent sig n (no operand) |
@author weixin public account
这里写图片描述
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信3292 次点击
上一篇:Go语言发展状况和前景
下一篇:Go计算运行的时间
添加一条新回复
(您需要 后才能回复 没有账号 ?)
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
fmt.print参数规约
printf输出规约是按照预定义好的参数格式输出的,参数和对应说明如下表所示。
| parameter | description |
|---|---|
| %d | decimal integer |
| %x, %o, %b | integer in hexade cimal, octal, binar y |
| %f, %g, %e | floating-p oint number: 3.141593 3.141592653589793 3.141593e+00 |
| %t | boole an: true or false |
| %c | rune (Unico de co de point) |
| %s | string |
| %q | quoted str ing "abc" or rune ‘c’ |
| %v | any value in a natural format |
| %T | type of any value |
| %% | literal percent sig n (no operand) |
@author weixin public account
这里写图片描述