[ create a new paste ] login | about

Link: http://codepad.org/VWHtgYoc    [ raw code | output | fork ]

Python, pasted on Dec 24:
1
2
3
4
5
6
7
d = {0:'tom',1:'cat',2:'apache',4:'server',5:'open'}

items = sorted(d.items())

result = dict(enumerate([' '.join(b for a, b in items[:3])] + [b for a, b in items[3:]]))

print(result)


Output:
1
{0: 'tom cat apache', 1: 'server', 2: 'open'}


Create a new paste based on this one


Comments: