This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:python:misc_by_jyp [2021/09/17 13:41] jypeter [Printing a readable version of long lists or dictionaries] Replaced ordered dict with a regular dict |
other:python:misc_by_jyp [2021/10/26 11:27] jypeter Added sorting section |
||
---|---|---|---|
Line 184: | Line 184: | ||
'r1i1p1f3': {'grid': 'gr'}, | 'r1i1p1f3': {'grid': 'gr'}, | ||
'r1i1p1f4': {'grid': 'gr'}}} | 'r1i1p1f4': {'grid': 'gr'}}} | ||
+ | |||
+ | >>> dir(test_dic) | ||
+ | ['__class__', '__contains__', '__delattr__', [... lots of unreadable stuff removed...] 'setdefault', 'update', 'values'] | ||
+ | |||
+ | >>> pprint.pprint(dir(test_dic)) | ||
+ | ['__class__', | ||
+ | '__contains__', | ||
+ | |||
+ | [... lots of lines removed in this example ] | ||
+ | |||
+ | 'setdefault', | ||
+ | 'update', | ||
+ | 'values'] | ||
+ | |||
</code> | </code> | ||
+ | |||
+ | ==== Sorting ==== | ||
+ | |||
+ | <code>Some code</code> | ||
/* | /* |