Is there a Python equivalent to template literals in JavaScript?

You can go with formatted string literals (“f-strings”) since Python 3.6

f"Hi {name}, you are {age}"

Or string formatting

"Hi {}, you are {}".format(name, age)
"Hi {name}, you are {age}".format(name=name, age=age)

Or format specifiers

"Hi %s, you are %d" % (name, age)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)