字符串新功能

在python 3.6增加了f-string,对比js:

//js
var a = "x"
`this is ${a}` //this is x
#python
a = "x"
f"this is {a}" #this is x
"this is %s" % a  #this is x

标签: none 阅读量: 1094

添加新评论