據廖雪峯python3教程----python學習第三天

格式化輸出 Python中的格式化輸出與C語言是一致的都可以用 % 來實現 eg: 1 2 3 4 >>>  'hello,%s' % 'world' 'hello,world' >>>  'Hi,%s,you have $%d.' % ( 'XiaoMing' , 1000 ) 'Hi,XiaoMing,you have $1000.' % 運算符是用來格式化字符串的。在字符串內部, %s 表示
相關文章
相關標籤/搜索