摘要: #format拼接字符串,format()内的参数必须为可迭代的对象p1="i am {2},age {1},{0}".format("seven",18,'alex') print(tp1) tp1="i am {1},age {1}".format("seven",18,'alex')#按照元祖下标取值 print(tp1) tp1="i am {name},age {age},r... 阅读全文
posted @ 2019-06-03 07:47 coldplaycode 阅读(344) 评论(0) 推荐(0) 编辑
摘要: msg="I am "+"king" print(msg) print("I am %s of the %s" % ("tang","king"))#%s 字符串占位符 print("I am %s of age %s" % ("tang",[20,11]))#%s 字符串占位符 print("I am %s of the %d" % ("tang",1))#%d 整型占位符 #打印浮... 阅读全文
posted @ 2019-06-03 07:36 coldplaycode 阅读(115) 评论(0) 推荐(0) 编辑

coldplaycode