logoalt Hacker News

TZubiritoday at 8:10 PM4 repliesview on HN

Been using python for almost 10 years. I never use any of the funky strings.

Instead of reading like 10 PEPs for f strings, I just use the + operator on strings and backslash escaping, big whoop.


Replies

PyWoodytoday at 8:34 PM

Instead of 10 PEPs, you could read one helpful cheatsheet: https://www.pythonmorsels.com/string-formatting/#cheat-sheet....

show 1 reply
andaitoday at 8:28 PM

age = 32

print(f"Age: {age}")

Thus concludes the lecture on f-strings.

show 2 replies
jherikotoday at 9:00 PM

[dead]

smoharetoday at 8:24 PM

Right, because x + " " + y is more clear than of simply f"{x} {y}".

Been using python for longer than 10 years and immediately started using f-strings when I could. It takes almost no time to understand the basics.

show 1 reply