Profile
Achievement
magicrebirth's Recent SnippetsTagged list
- All /
« Prev 1 Next »
Not only is it really really fast; it's also order preserving and supports an optional transform function
0
1063
posted 13 years ago by magicrebirth
The resulting tree is represented through a dict where each father gets a key (with all the children as args)
0
974
posted 14 years ago by magicrebirth
Turning a dictionary into a list or an iterator is easy. To get a list of keys, you can just cast the dict into a list. It's cleaner, though to call .keys() on the dictionary to get a list of the keys, or .iterkeys() to get an iterator. Similarly, yo...
0
664
posted 14 years ago by magicrebirth
// Is there a way in python to convert a list say [1,2,3,4] to a string and
// also how to convert a string to a list?
// use str() or repr() to convert to a string.
// eval() will convert back to a list.
0
659
posted 14 years ago by magicrebirth