Skip to content

Tag: string.format

Str.format with a list to create filter

Somewhat simple question with many similar ones out there, but I cannot seem to find what I am looking for. I am trying to filter a list of images in a dbc.Carousel via an int list of location numbers. Any image title that starts with a given number will correlate to a location. So, initially, I would want al…

How to iterate dict in string.format

I read a lot of tutorials, but can not find how to iterate dict in string.format like this: which I want a result like this: so I can print variable length dict. Then I got error. Answer Currently your output is: That’s because k for k,v in dict is a generator expression. Don’t confuse it with set…