Coding is my Superpower! 💻 Unleash your Programming Prowess with this Stylish T-Shirt! 🚀 Embrace the World of Algorithms and Debugging in Style! 💡 Wear it Proudly, Geek it Smartly! 🤓
🤔 Think you know the answer? Put your knowledge to the test with our latest quiz! . . 🎯 Don't miss a single post by turning on post notifications! 🔔 🎯 If you like our content, hit the follow button to stay in the loop! 👉 @techpaathshala
Are you ready to embark on an exciting coding journey? 🌟 Our Online 1:1 Coding Classes are here to take your skills to the next level! 🖥️💡
🌐 Explore the world of coding from the comfort of your home.
👩💻 Personalized 1:1 sessions with expert instructors.
📈 Beginner to advanced coding courses available.
💡 Boost your problem-solving skills and creativity.
🌈 Join a community of passionate coders.
🎉 Start your coding adventure today!
Ready to get started? 🚀
🌐 Visit our website: https://learncodes.co.in
📞 Call us at +91-7544842581
Elevate your business with Greemus Software Technologies! 🚀 We specialize in software development, web and mobile app development, digital marketing, business development, graphics designing, database management, and software testing. take your brand to new heights! 💻📱✨ #GreemusTech#TechSolutions#BusinessGrowth
The following posts will concern Paneity, a personal project that is a new programming language. It has been written in Python, and there already exists a basic IDE, all made by me.
So excited! In order to prepare for our #javascript assessment next week I'm hosting a trivia game with prizes from the fantastic ppl at @gocodeup for the winners in the #Ulysses cohort!! #fun #code #girlcoder #html #css #jquery #WIT #codegeek #codeninja #notes
Air pollution turned into ink turned into street art, sends a powerful message
Air pollution turned into ink turned into street art, sends a powerful message
Roaring street art inked with air pollution.
If you live in a big city like London, you most probably know that air pollution is slowly killing you.
One of the biggest contributors to toxic emissions are vehicles. So an Indian startup is sucking the problem from its roots. Literally. From the place it becomes a problem.
It blocks diesel emissions at the point of contact with the atmosphere,…
Part 2- Our top picks for code editors are sure to enhance your productivity and coding experience. Which one is your go-to? Let us know in the comments!
🎯 Don't miss a single post by turning on post notifications!
🎯 If you like our content, hit the follow button to stay updated!!
How to select/reduce a list of dictionaries in Flask/Jinja
I have a Jinja template with a list of dictionaries. Order matters. I'd like to reduce the list or lookup values based on the keys/values of the dictionaries. Here's an example:
{% set ordered_dicts = [ { 'id': 'foo', 'name': 'My name is Foo' }, { 'id': 'bar', 'name': 'My name is Bar' } ]%}
If I have a variable some_id = 'foo', how do I get 'My name is Foo' out of ordered_dicts in my Jinja template?
I tried select() and selectattr() but couldn't figure them out based on the documentation. Here's what I tried:
{{ ordered_dicts|selectattr("id", "foo") }}
That outputs:
<generator object _select_or_reject at 0x10748d870>
I don't think I'm understanding the use of select() and selectattr() properly.
Do I need to iterate over the list and do the lookup manually?
Update:
As codegeek and gipi pointed out, I need to do something like this with the generator:
{{ ordered_dicts|selectattr("id", "foo")|list }}
The resulting error: TemplateRuntimeError: no test named 'foo', which clarifies how selectattr() works. The second argument has to be one of the builtin tests. As far as I can tell, none of these tests will let me check whether the value associated with a key matches another value. Here's what I'd like to do:
But that doesn't work, since the sameas test checks whether two objects are really the same object in memory, not whether two strings/numbers are equivalent.
So is it possible to pick an item based on a key/value comparison test?