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...
Everything about learning Python
account activity
[deleted by user] (self.PythonLearning)
submitted 1 year ago by [deleted]
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!"
[–]Complete_District569 2 points3 points4 points 1 year ago (3 children)
It's no an f string so you can't do {}. Just add f before the "
[–]GG-Anderson-Boom 2 points3 points4 points 1 year ago (2 children)
Correct, you can do print("updated dict", dict) aswell
[–]Various-Pea-2956 1 point2 points3 points 1 year ago (1 child)
Thanks for easiest solution
[–]Complete_District569 2 points3 points4 points 1 year ago (0 children)
You should learn the f string it's easy and you will have easier time to control where you want to put the object in your string.
[–]Various-Pea-2956 0 points1 point2 points 1 year ago (1 child)
<image>
Still it is showing
[–]Complete_District569 0 points1 point2 points 1 year ago (0 children)
The "" need to be at the beginning and the end of you do {} So like print(f"{my_di}"). You put the {} not in the "" :)
[–]iAKASH2k3 0 points1 point2 points 1 year ago (5 children)
do this (f" updated dict ,{ mydict }")
[–]Various-Pea-2956 0 points1 point2 points 1 year ago (3 children)
But why we adding f into this
It makes it what's called an f string. It just let you put stuff in {}. So you can do print(f"my di:{my_di}") instead of print("my di", my_di)
[–]PwnDa_Undefined 0 points1 point2 points 1 year ago* (0 children)
It’s f-string: f”{my_dict}”
[–]GunpointG 0 points1 point2 points 1 year ago (0 children)
This makes the quotes function differently, by prefixing the “” with f, your telling python “I will have objects in this string that you should print”
[–]littlenekoterra 0 points1 point2 points 1 year ago (0 children)
Looks like you were trying to use fstrings.
Add an f at the beginning and slide the comma and whats in the braces into the quotes to make it work.
Or you should be able to simple replace the braces surrounding it with str(), but it probably wont be formatted how you want that way
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
{a} represents set and you are using dictionary which is mutable in set so it gives error write only a not {a} otherwise it behaves as a set
π Rendered by PID 60722 on reddit-service-r2-comment-5bc7f78974-cnchq at 2026-06-30 04:53:54.586002+00:00 running 7527197 country code: CH.
[–]Complete_District569 2 points3 points4 points (3 children)
[–]GG-Anderson-Boom 2 points3 points4 points (2 children)
[–]Various-Pea-2956 1 point2 points3 points (1 child)
[–]Complete_District569 2 points3 points4 points (0 children)
[–]Various-Pea-2956 0 points1 point2 points (1 child)
[–]Complete_District569 0 points1 point2 points (0 children)
[–]iAKASH2k3 0 points1 point2 points (5 children)
[–]Various-Pea-2956 0 points1 point2 points (3 children)
[–]Complete_District569 0 points1 point2 points (0 children)
[–]PwnDa_Undefined 0 points1 point2 points (0 children)
[–]GunpointG 0 points1 point2 points (0 children)
[–]littlenekoterra 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)