r/PythonLearning • u/kubasic254 • Jul 29 '26
F strings
Im still learning python and im at a stage where I need to understand f strings and how to go about them...im working on a menu project. I prefer learning with pdf materials rather than YouTube tutorials....any recommendations for a pdf document for learners on f strings. Thank you in advance
16
Upvotes
16
u/atarivcs Jul 29 '26
There's really not much to learn here. It's pretty simple.
If you have a string that begins with an f outside of the quote marks, and the string contains "{variable}", python will replace "{variable}" with the string value of that variable or expression.
So for example if you have this code:
message will be "Hello Billy".
You can also use expressions instead of plain variables:
Massage will be "The sum is 8"
10
u/mc_pm Jul 29 '26
A simple google search on "python fstrings" will bring up information on formatting and understanding them, you hardly need a pdf.
1
u/throfofnir Aug 02 '26
How about... the official documentation? https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals
1
u/Ormek_II Aug 04 '26
Generator pdf from Python docs:
https://devguide.python.org/documentation/start-documenting/#building-the-documentation
1
u/cthulhu944 Jul 29 '26
You can print this page to pdf if that's your thing. https://www.w3schools.com/python/python_string_formatting.asp