Demo entry 6337914

python code

   

Submitted by anonymous on Dec 09, 2016 at 21:10
Language: Python. Code size: 273 Bytes.

def build_link_index():
    new_dict = {}
    for link in links:
        new_dict[link.id] = link
    return new_dict

print build_link_index()

link_index = build_link_index()

def link_by_id(link_id):
    return link_index.get(link_id)

print link_by_id(2)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).