python 输出语句的写法 |
您所在的位置:网站首页 › python输入语句怎么写 › python 输出语句的写法 |
标签:color one 不能 hot format 不同 总结 bin hello 总结: 1、类似于C语言的格式化输出,先写转换符,再写待转换的对象。 2、与C语言不同的是,转换符和待转换的对象之间,不能用逗号分隔。 1 #!/usr/bin/env python 2 3 4 #print digital variable 5 p = 10 6 x = 20 7 print("p=%d x=%d" %(p,x)) 8 9 #print string object 10 format = "Hello , %s. %s enough for ya?" 11 values = (‘world‘, ‘Hot‘) 12 print(format%values) 13 14 #print dictionary object 15 phonenum = {‘Beth‘: ‘9102‘, ‘Alice‘:‘2341‘, ‘Cecil‘:‘3258‘} 16 print("Cecil‘s phone number is %(Cecil)s"%phonenum)
python 输出语句的写法 标签:color one 不能 hot format 不同 总结 bin hello 原文地址:http://www.cnblogs.com/zhouhaibing/p/7442183.html |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |