'''%s %的用法%s為第二個%中的元素占位,將該元素格式化為字符串%d %的用法%d為第二個%中的元素占位,將該元素格式化為整型%s或%d,占位符,并且格式化%s,格式化為字符串%d,格式化為int'''#例name = input("who are you ? plea input your name: ")print("my name is : %s" %name)#例,第二個%中的字符串要用引號引起來print("hello %s, my name is %s" %('robert', 'bill'))print("My name is %s, and I'm %d" %('bill', 12))
運行結果:who are you ? plea input your name: bill
my name is : bill
hello robert, my name is bill
My name is bill, and I'm 12
本文發布于:2023-02-28 21:09:00,感謝您對本站的認可!
本文鏈接:http://www.newhan.cn/zhishi/a/1677730920100886.html
版權聲明:本站內容均來自互聯網,僅供演示用,請勿用于商業和其他非法用途。如果侵犯了您的權益請與我們聯系,我們將在24小時內刪除。
本文word下載地址:%s(%s和%c).doc
本文 PDF 下載地址:%s(%s和%c).pdf
| 留言與評論(共有 0 條評論) |