Hi all, today was a good day. I finally started researching on the underscore.js module today and I could find out a couple of stuff about it.
For one, it is a library which supports javascript. This basically adds to the functional aspects you get to work within Python as well. So this method is called pluck.
Now consider this - Let us say I have a requirement wherein I have to pluck out a specific attribute, this is what I'd do:
users = [{
"name" : "Edureka",
"uid" : "744639207"
},
{
"name" : "Anirudh",
"uid" : "3"
}]
uids = map(lambda x:x["uid"], users)
If the shorthand for the underscore is present somewhere in the same Python code, would the following piece of code be possible?
Code:
uids = pluck(users, "uid")
All help appreciated!