I am a total novice at Python, and have come across a piece of code that confuses me.
ts, pkt2 = capPort2.wait(1, 45)[0]
The previous line
Ah, I think this question answered my own recently, but I would like to extend the answer some:
This call:
var value = getUrlVars()["logout_url"];
would end up setting the variable to the value of the 'logout_url' name-value pair that is returned from the function call to 'getUrlVars()', right? So you don't have to use just a numeric index, it can be used on hash/associative arrays/dictionary/etc results from the function.
So if this is the function 'getUrlVars':
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace (/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
}
);
return vars;
}
Which is returning key value pairs (from an input URL of ""http://a.place.com/page.html?name=fred&place=b3&logout_url=some.thing.net/go/here/file.html"), e.g.:
'name'='fred',
'place'='b3',
'logout_url'='some.thing.net/go/here/file.html' <-- URL encoded, most likely
So my function call above would return "some.thing.net/go/here/file.html", while one that looks like this:
getUrlVars()["name"]
would return:
"fred"
I think. :)
-- C