Loading topic
for loop. The earlier refresher covered those basics.6 min readfor loops and functions. The previous chapter described the common nesting shapes: list of dicts, dict of lists, dict of dicts, and list of lists. This chapter covers re6 min readfor loops and simple functions, index lists, and look up dictionary keys. It also assumes you have read the previous chapter on chained indexing, such as data["users"][0]["name"].5 min readfor loop, call functions, and read nested data with chained indexing such as students[1]["grades"][2]. It also assumes you know how to change nested values in place. The goal here is to visit every part of a nested structure without errors, and to choos6 min readsetdefault(), and `collections.defaultdic6 min readfor loops and simple functions, and know the difference b6 min read[[0] * 3] * 2 produces rows that are the same list. Copying is the other place where that idea causes bugs.6 min readjson module converts between the two, which values change or fail in the conversion, and how to read JSON you don't control.6 min readdata["a"][1]["b"]. That works when you know the shape in advance. This chapter covers data whose depth you don't know: a comment thread, a menu tree, a parsed JSON response, a configuration file with optional sections. It assumes you 7 min readget(), defaultdict, copy.deepcopy() and the json module from earlier chapters. Here you will learn to recognize when a nested structure has stopped helping and what to use in its pl6 min read