标签:格式化输出 UNC 字符 处理 bsp 示例 nbsp print 输出
1、示例
package main //必须有一个main包 import "fmt" func main() { a := 10 //一段一段处理,自动加换行 fmt.Println("a = ", a) //格式化输出, 把a的内容放在%d的位置 // "a = 10\n" 这个字符串输出到屏幕,"\n"代表换行符 fmt.Printf("a = %d\n", a) }
#执行结果:
a = 10 a = 10
示例2:
package main //必须有一个main包 import "fmt" func main() { a := 10 b := 20 c := 30 fmt.Println("a = ", a, ", b = ", b, ", c = ", c) fmt.Printf("a = %d, b = %d, c = %d\n", a, b, c) }
#执行结果:
a = 10 , b = 20 , c = 30 a = 10, b = 20, c = 30
标签:格式化输出 UNC 字符 处理 bsp 示例 nbsp print 输出
原文地址:https://www.cnblogs.com/nulige/p/10199448.html