据廖雪峰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 表示
相关文章
相关标签/搜索