Advanced Python Topics: File Operations in Python


Overview/Description
Expected Duration
Lesson Objectives
Course Number
Expertise Level



Overview/Description

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.



Expected Duration (hours)
1.2

Lesson Objectives

Advanced Python Topics: File Operations in Python

  • discover the key concepts covered in this course
  • use the open function in Python to open a file for reading
  • recognize the differences between the read(), readline(), and readlines() functions when working with files in Python
  • recall the differences between opening a file in write mode and append mode
  • distinguish between the r+ and a+ modes to read from and write to a file
  • use the load and loads functions of the json module to parse JSON data
  • convert Python dictionaries and lists into JSON strings and files
  • identify some of the file formats that can be handled by the CSV module in Python
  • convert Python dictionaries and lists into CSV files
  • define a customized file format creating a CSV dialect and use that to parse and write data
  • summarize the key concepts covered in this course
  • Course Number:
    it_pyatpydj_01_enus

    Expertise Level
    Beginner