Message253363
Oops, minor flaw with that. It's str-ifying the tuples, not the keys, which could (in some cases) cause issues with keys whose reprs have different quoting. So you'd end up with lambdas. Boo. Anyway, corrected version (which would probably not be one-lined in real code):
json.dumps(collections.OrderedDict(sorted(mydict.items(), key=lambda x: str(x[0])))) |
|
Date |
User |
Action |
Args |
2015-10-23 03:01:57 | josh.r | set | recipients:
+ josh.r, tanzer@swing.co.at |
2015-10-23 03:01:57 | josh.r | set | messageid: <1445569317.05.0.0955449357224.issue25457@psf.upfronthosting.co.za> |
2015-10-23 03:01:57 | josh.r | link | issue25457 messages |
2015-10-23 03:01:56 | josh.r | create | |
|