The F-String
Image credit
Another way to concatenate strings.
Hi guys, sorry it's been a fortnight! I've been hella busy and still am so this is going to be short.
So I recently discovered the f-string in python.
a_string = " are pretty damned cool!"
print("f-strings" + a_string)
So I'm sure most of us are familiar with the above for good old string concatenation. If you are super tricky, you might even know�
a_string = " are pretty damned cool!"
print("f-strings{0}").format(a_string)
These are both well and good, but I have recently learned of a method i enjoy more than both of these.
a_string = " are pretty damned cool!"
print(f"f-strings{a_string}")
Simple. Concise. Beautiful.
Stay tuned for next week!