版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bq_cui/article/details/89887376
# -*- coding: utf-8 -*-
"""
Created on Mon May 6 17:25:54 2019
@author: Administrator
"""
s='hello,%s' %'world'
print(s)
s='hello,%s,this is %s' %('world','python')
print(s)
s='%.2f' %3.13159265
print(s)
s='age:%s,gender:%s' %(25,'male')
print(s)
s='we must keep rate at %s %%' %7
print(s)
运行:
hello,world
hello,world,this is python
3.13
age:25,gender:male
we must keep rate at 7 %