模板字符串: js tagged template string VS python3.14 t-string

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Template_literals#带标签的模板

https://docs.pythonlang.cn/3/library/string.templatelib.html

起因:https://lit.dev/ 有这种写法,头一次见😂
又搞新语法,折腾开发者了😂

js

function html(strings: string[], ...values) {}

html`a ${x} b ${y} c`
# 等价于
html(["a ", " b ", " c"], x, y)

python

t"a {kwarg1} b"

TODO

posted @ 2026-06-06 10:50  Nolca  阅读(5)  评论(0)    收藏  举报