Advanced Python Topics: File Operations in Python

Python    |    Beginner
  • 11 videos | 1h 11m 38s
  • Includes Assessment
  • Earns a Badge
Rating 4.5 of 226 users Rating 4.5 of 226 users (226)
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.

WHAT YOU WILL LEARN

  • 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

IN THIS COURSE

  • 2m 13s
    In this video, you'll learn about the file operations in Python. We will start by looking at how we can read data from unformatted X Files, and explore the different ways in which such files can be passed. From reading data in chunks to accessing data at specific points in the file. FREE ACCESS
  • 8m 40s
    In this video, you will learn how to use the open function in Python to open a file for reading. FREE ACCESS
  • Locked
    3.  The Different Read Functions
    7m 44s
    Upon completion of this video, you will be able to recognize the differences between the read(), readline(), and readlines() functions when working with files in Python. FREE ACCESS
  • Locked
    4.  Writing to Files in Python
    8m 30s
    After completing this video, you will be able to recall the differences between opening a file in write mode and in append mode. FREE ACCESS
  • Locked
    5.  The r+ and a+ Modes
    7m 13s
    In this video, you will learn about the r+ and a+ modes. You will also discover how to open a file in append mode. FREE ACCESS
  • Locked
    6.  Reading JSON Data in Python
    7m 40s
    In this video, you will learn how to work with JSON formatted data within files. You will also discover how to create a new JSON file, and then save it. FREE ACCESS
  • Locked
    7.  Transforming Python Objects into JSON
    6m 27s
    In the previous video, we saw how we can both read JSON data from strings as well as files, and then load them into a Python dictionary. In this video, we will start off by initializing another Python dictionary. FREE ACCESS
  • Locked
    8.  Parsing Different Forms of CSV files
    8m 16s
    In this course, we have taken a look at how we can work with text files in Python. We have also covered the use of the JSON module in order to work with specific kinds of text files which contain data in the JSON format. It is now time for us to examine one more module available for Python in order to work with CSV data. FREE ACCESS
  • Locked
    9.  Transforming Python Objects into CSV
    8m 46s
    In the previous video, we saw how we can use the csv.reader object in order to load the contents of a CSV file, and then make each row available within our Python code in the form of a list of strings. FREE ACCESS
  • Locked
    10.  CSV Dialects
    4m 37s
    When working with the CSV module, we have seen that the data which we can work with need not necessarily be comma separated values. We can have tab separated values, pipe separated values, and in fact, there is a lot of flexibility in terms of the types of files which we can work with. FREE ACCESS
  • Locked
    11.  Course Summary
    1m 31s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 149 users Rating 4.5 of 149 users (149)
Rating 4.5 of 113 users Rating 4.5 of 113 users (113)
Rating 4.4 of 90 users Rating 4.4 of 90 users (90)