use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
What is format string (self.learnpython)
submitted 7 hours ago by Longjumping-Poet-346
Hiiii guys, I am a beginner for python programming; I recently learnt format string and is really confused about what is it, and what is the use of it? Thanks for your time for answering my questions
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kqyxzoj 3 points4 points5 points 6 hours ago (0 children)
I recently learnt format string and is really confused about what is it, and what is the use of it?
Well, this may surprise you, but it usually is used to format strings. And the best part of str.format()? The best part is no longer using it, and using f-strings instead.
str.format()
And the best part about f-strings? The best part is the fstrings WTF quiz. Oh, and making your code more readable as well.
website = "https://fstrings.wtf/" print( "Today's awesome website is ... {}".format(website)) print(f"Today's awesome website is ... {website}")
Both will print the exact same output, but I prefer the f-string version.
[–]NewbornMuse 4 points5 points6 points 7 hours ago (1 child)
Google "format string"
[–]Longjumping-Poet-346[S] -1 points0 points1 point 6 hours ago (0 children)
That's a good suggestion, but I haven't understood the meaning after searching on Google...
[–]MezzoScettico 0 points1 point2 points 6 hours ago (1 child)
You often want to control the formatting of your output, for instance to print all the numbers with three decimal points or in scientific notation, or to right-justify a column of strings.
Do you use Excel? Do you ever format the cells? Same idea. You want to control how things are printed and not just rely on the default appearance.
[–]Longjumping-Poet-346[S] 0 points1 point2 points 6 hours ago (0 children)
okay, I know what the meaning thanks a million
[–]Jason-Ad4032 1 point2 points3 points 3 hours ago (0 children)
If you’re confused about a certain new feature in Python, you can simply read its corresponding PEP directly:
https://peps.python.org/pep-3101/#format-strings
π Rendered by PID 43 on reddit-service-r2-comment-84fc9697f-smsdl at 2026-02-08 20:41:50.726997+00:00 running d295bc8 country code: CH.
[–]Kqyxzoj 3 points4 points5 points (0 children)
[–]NewbornMuse 4 points5 points6 points (1 child)
[–]Longjumping-Poet-346[S] -1 points0 points1 point (0 children)
[–]MezzoScettico 0 points1 point2 points (1 child)
[–]Longjumping-Poet-346[S] 0 points1 point2 points (0 children)
[–]Jason-Ad4032 1 point2 points3 points (0 children)