NodeJS像Python一样的字符串格式? [英] NodeJS String format like Python?
本文介绍了NodeJS像Python一样的字符串格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在python中,我可以执行以下操作:
In python, I can do the following:
name = "bob"
print("Hey, %s!" % name)
有没有类似的东西(或Python的< JavaScript / NodeJS中的code> .format())
Is there anything similar to that (or Python's .format()
) in JavaScript/NodeJS?
推荐答案
sprintf 应该按照我的要求做你想要的。
sprintf should do what you are asking for I think.
这篇关于NodeJS像Python一样的字符串格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文