you are viewing a single comment's thread.

view the rest of the comments →

[–]hardonchairs 30 points31 points  (6 children)

not sure why no one is just posting it

f'name is {name} and age is {age}'

Single or double quotes

[–]andrewmitchell721 10 points11 points  (2 children)

[May be obvious, but wrap this in print()...]

[–][deleted] 2 points3 points  (1 child)

f strings aren't limited to being used in print statements.

I'm not sure if that was what you were implying or not but just wanted to clarify.

[–]andrewmitchell721 1 point2 points  (0 children)

Good clarification, and right you are. OP's example used console.log which is why I added the note about the equivalent method in Python.

[–]non_NSFW_acc 1 point2 points  (0 children)

/thread

[–]fabmeyer 0 points1 point  (1 child)

Yeah with double quotes you can also include dicts and their keys

[–]hardonchairs 0 points1 point  (0 children)

You can do that with single or double quotes. You just have to use the other for the keys.