东莞市盛裕绒艺玩具有限公司

东莞市盛裕绒艺玩具有限公司

和记娱乐备用入口

15222335684
联系方式
全国服务热线: 15222335684

咨询热线:18862535467
联系人:卢扬
地址:十里河花卉产业园

python字符串拼接相关

来源:和记娱乐备用入口   发布时间:2019-10-31   点击量:275

#字符串拼接#str.join(元组、列表、字典、字符串) 之后生成的只能是字符串。str = "-";seq = ("a", "b", "c"); # 字符串序列sqr=["a","b","c","sss"]#listssr=str.join(sqr)print("=".join(ssr))

print (str.join(sqr));print (str.join(seq));

seq = {"hello":"nihao","good":2,"boy":3,"doiido":4}#对象print("-".join(seq))

#打印字符print ("His name is %s"%("Aviad"))#1. 打印字符串#http://www.cnblogs.com/plwang1990/p/3757549.htmlprint ("He is %d years old"%(25))#2.打印整数print ("His height is %f m"%(1.83))#3.打印浮点数print ("His height is %.2f m"%(1.83))#4.打印浮点数(指定保留小数点位数)print ("Name:%10s Age:%8d Height:%8.2f"%("Aviad",25,1.83))#5.指定占位符宽度print ("Name:%-10s Age:%-8d Height:%-8.2f"%("Aviad",25,1.83))#6.指定占位符宽度(左对齐)print ("Name:%-10s Age:%08d Height:%08.2f"%("Aviad",25,1.83))#7.指定占位符(只能用0当占位符?)

相关产品

COPYRIGHTS©2017 和记娱乐备用入口 ALL RIGHTS RESERVED 备案号:275