Loading topic
with, and how to catch exceptions. You do not need any earlier JSON experience. The chapter covers the JSON data model and how the json module converts between JSON values and Python obj6 min readwith statement for files, and how to handle exceptions. You should also know that JSON values map to Python types (objects to dicts, arrays to lists, true/false to True/False, null to None). Here you will6 min readjson.dumps and json.dump and know how JSON values map to Python types. It covers the options that change how the text looks without changing the data it describes: indent, sort_keys, ensure_ascii, separators, and a few related switches.6 min readjson.load, json.loads, json.dump, and json.dumps. It also assumes you know try/except, how to open files with with, and that a Python str holds text while bytes holds raw data. Here you will learn what json.JSONDecodeError tells you, how 6 min readjson.dumps and json.loads, and that you know how Python maps JSON values to its own types (see the earlier chapters on the JSON data model and on reading and writing JSON). You should also be comfortable with isinstance, classes, and exceptions.6 min readcsv module: csv.reader and csv.writer. I assume you can open files with with, loop over lists, and catch exceptions. You should also know why files need an explicit encoding, which the file handling chapter at the start of this tutorial c5 min readwith statement, and handle exceptions. It also assumes you know the basics of csv.reader and csv.writer, and why CSV files are opened with newline="" and an explicit encoding.5 min readcsv module reads every field as text. This chapter shows how to convert those strings into int, float, Decimal, bool, date, and datetime values, how to handle blank fields, and how to report bad rows without stopping the whole run.5 min readcsv.reader, csv.writer, DictReader, and DictWriter. It also assumes you open CSV files with newline="" and an explicit encoding. Here you will learn how the csv module decides where one field ends and the next begins, and how to change those rul6 min readjson.load, json.dumps, csv.reader, and csv.DictReader. You should also know how to open files with with, and how generators and yield work. The earlier chapters on encodings and newline='' apply here unchanged.7 min read