Python基础语法一(转载)
利用百分号格式化:
s1 = "I love python %d 遍"
print(s1%(1000))
s1 = "I love python %d 遍 and %d"
print(s1%(100, 1000))
format函数格式化字符串:
# format例子
s1 = "I love python {} 遍"
print(s1.format(100)
s1 = "I love python {} 遍 and {} 遍"
print(s1.format(100, 1000)
..
原创
2021-12-04 23:26:55 ·
632 阅读 ·
0 评论