I have an array with loads of dictionaries in it. However I want to sort dictionaries in a way where I have maximum value to a specific key in a dictionary. For example I have a list that looks like this  [     {         "num_gurus": 40,         "id": 119749,         "code": null,         "name": "ART 198P",         "short_name": "ART 198P",         "title": "Directed Group Study",         "department_long": null,         "full_name": "Directed Group Study",         "department_short": "ART"     },     {         "num_gurus": 3,         "id": 119825,         "code": null,         "name": "ASAMST 198P",         "short_name": "ASAMST 198P",         "title": "Supervised Group Study",         "department_long": null,         "full_name": "Supervised Group Study",         "department_short": "ASAMST"     },     {         "num_gurus": 200,         "id": 119904,         "code": null,         "name": "AST 636",         "short_name": "AST 636",         "title": "Baudelaire: Art Poetry Modernity",         "department_long": null,         "full_name": "Baudelaire: Art Poetry Modernity",         "department_short": "AST"     } ]   I want my output to sort my dictionaries where the value of a key attribute 'num_gurus' is maximum to minimum. Expected output would be.  [     {         "num_gurus": 200,         "id": 119904,         "code": null,         "name": "AST 636",         "short_name": "AST 636",         "title": "Baudelaire: Art Poetry Modernity",         "department_long": null,         "full_name": "Baudelaire: Art Poetry Modernity",         "department_short": "AST"     }     {         "num_gurus": 40,         "id": 119749,         "code": null,         "name": "ART 198P",         "short_name": "ART 198P",         "title": "Directed Group Study",         "department_long": null,         "full_name": "Directed Group Study",         "department_short": "ART"     },     {         "num_gurus": 3,         "id": 119825,         "code": null,         "name": "ASAMST 198P",         "short_name": "ASAMST 198P",         "title": "Supervised Group Study",         "department_long": null,         "full_name": "Supervised Group Study",         "department_short": "ASAMST"     }  ]   I have tried this so far      for items in load_as_json:             for key, val in sorted(items['num_gurus'].iteritems(), key=lambda (k,v): (v,k), reverse=True):                 print key,val  This throws me error and doesn't do what I actually want to. This is the error I got.   File "utils.py", line 61, in GetPopularCoursesBasedOnGurus     for key, val in sorted(str(items['num_gurus']).iteritems(), key=lambda (k,v): (v,k)): AttributeError: 'str' object has no attribute 'iteritems'
I have a list of dictionaries and want each item to be sorted by a specific value. Take into consideration the list: [{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]  When sorted by name, it should become: [{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]
Can I include another file in fstab Can I include another file in my fstab file?  I.e. can I have fstab execute lines from another file at an arbitrary point, and then return to the main file when completed? All the info about TLP on the surface looks more like advertisement and marketing to me, I can't see any detailed comparison to default configurations. What are the precise differences compared to default (K/L)Ubuntu installs under the hood, are they really effective?  Update: And if they really are, why aren't they a part of a default config? Can I re-create deleted Gmail accounts? A long time ago, I created a Google mail account. I fell for a trap that was common back then (not sure how it is nowadays) and ended up with two Google accounts—one for Gmail (using the Gmail email address I would like to use) and one for everything else (using an email address at an external mail provider).  Hoping that I could associate my Gmail and my actual Google account, I deleted my Gmail account only to discover that deleted account names cannot be used again. So basically my old Gmail account along with the Google email address I would like to use is gone.  My main Google account got assigned a different Gmail account in the mean time.  Do you know if it is possible to re-use my preferred Gmail address? If possible, I would like to assign it to my main Google account. But I'd also be happy to have it as a second Google account, anything is better than the current situation. Mounting /cow on root failed: Invalid argument overlay mount failed I am using an xps 13 9365, which was data wiped from bios by a friend who then gave it to me thinking it was dead. I tried booting with a USB (current LTS distro (18.04 or similar)) boot disk and got into the language selection / setup menu. By using the F6 option I selected noapic. In bios sata is set to raid and legacy the secure boot option is off.   But when I try to install I get kicked into a tiny font window with the following message  (initramfs) mount: Mounting /cow on root failed: Invalid argument overlay mount failed  Any ideas? $x,y,z$ are independent and uniform random on $[0,1]$.  I know that $P(x \geq yz) = 3/4$ by triple integrating the triple density function.  However, is there a easier way to get this solution? Without triple integration. Why doesn't "System.out.println" work in Android? How to typeset asymmetrical confidence level limits / uncertainties? Why was the MCU Super Soldier program considered a failure? In Marvel Cinematic Universe, military tried to create super soldiers like Hulk, but they failed. So, the program was shut down.  Where did they fail? Didn't Blonsky get Wolverine-type super healing capability? Why couldn't it make the military stronger? Other than this, wasn't Abomination a success (despite the fact that it wasn't an original work of the military)? He was defeated by Hulk, but enemy forces don't have a Hulk. When it comes to anger, who cares as long as you are focused on the target? Abomination was indeed in full control and he was always after Hulk. When upgrading to Ubuntu 14.04 from Ubuntu 12.04 I am getting the following error:     W:Failed to fetch    Unable to find expected entry 'non-free/source/Sources' in Release   file (Wrong sources.list entry or malformed file) , E:Some index files   failed to download. They have been ignored, or old ones used instead. Is there way to enable more than 4 GB RAM in 32-bit Windows OS? I upgraded my PC to 4 GB RAM and I get only 3 GB. Windows 7 32-Bit consider that I've 4 GB RAM but didn't use more than 3 GB.  Someone told me that MS Windows 32-bit doesn't support RAM larger than 3 GB.  So please is there any way to make my OS "Windows 7 32-Bit" support more than 3 GB RAM ?  *`Note: I can't move to 64-bit because I've many program doesn't work with a 64-bit OS.  Edit::  I tried what Mr. Wonsungi advised me but whenever I check this option:      Enable support for 4 GB of RAM   I get the following error:      'Cannot access to the registry key   HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-11d1-A9F0-00AA0060FA31}.'   There is no "CLSID" in my registry, I don't know why!. How can I sanitize user input with PHP? Is there a catchall function somewhere that works well for sanitizing user input for SQL injection and XSS attacks, while still allowing certain types of HTML tags? How to model the curly cable part of the phone Hello. I am a beginner in Blender. I started modeling this phone and when I got to the curly cable part it was a real challenge. Could someone guide me on this. How to get a vintage/dreamy look like this photo?   It has some yellow color cast and seems like extra blur added in post process? Joel Spolsky asked what rhymes with orange. The official answer is, "Nothing," although a creative poet can get close by using half words, just the -nge part or resorting to place names and foreign words.  Does orange somehow violate the basic phonotactics of English? (And hence we wouldn't expect other English words to rhyme with it?) Checking to see if a DateTime variable has had a value assigned Need of the cold body in heat engine Prevent VLC from starting a new instance every time a media file is opened How to use Cubic to create a custom Ubuntu live CD image? How do I halt an android phone using adb command? I can reboot, but I don't know how to halt.  I tried shutdown -k wait command, but it did not work. Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly.  UPDATE: Check  about the same issue.