Skip to main content

Benx Shen's Library tagged snippets   View Popular

20 Oct 09

10.9. operator — Standard operators as functions — Python v2.7a0 documentation

  • operator.itemgetter(item[, args...])

    Return a callable object that fetches item from its operand using the
    operand’s __getitem__() method. If multiple items are specified,
    returns a tuple of lookup values. Equivalent to:


    def itemgetter(*items):
    if len(items) == 1:
    item = items[0]
    def g(obj):
    return obj[item]
    else:
    def g(obj):
    return tuple(obj[item] for item in items)
    return g
20 Oct 06

The JavaScript Source: Snippets : getXML


  • Obtain the contents of an XML element and convert it to text.
1 - 2 of 2
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo