Python includes functions and modules that simplify working with files. In this 11-video course, explore operations for standard text files and handling of formatted data such as JSON and CSV by using Python modules designed for such data. Learners begin with a look at some of the file operations in Python. Use Python's open function to open a file for reading, and differentiate between the read(), readline(), and readlines() functions. View differences between opening a file in write mode and append mode in Python. This leads on to distinguishing between the r+ and a+ modes to read from and write to a file; using load and loads functions of the json module to parse JSON data, and converting Python dictionaries and lists into JSON strings and files. Next, learn how to identify file formats that can be handled by the CSV module in Python, and convert Python dictionaries and lists into CSV files. The final tutorial concerns defining a customized file format, creating a CSV dialect, and using that to parse and write data.
Advanced Python Topics: File Operations in Python