Python: Working with Files

Python: Working with Files

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 1h 42m | 330 MB

When you’re working with files of any kind, nothing saves time like automation. No one wants to spend a day manually editing or renaming 1000 files. In this course, Kathryn Hodge shows you how to use Python to automate operating system tasks, aggregate data across multiple sources, save results to files, and level up your Python applications. Kathryn starts by introducing the idea of the file system with absolute versus relative paths, directory structures, and more. From there, she explores how to use tools from the Python Standard Library to retrieve metadata about the files and paths located on your machine. Once you know how to navigate to the appropriate files you want to work with, she shows how to process files with Python, parsing data not only in text formats, but also JSON and CSV. Finally, Kathryn looks at writing data to different file types and explains how to store that data within an archive well as with temporary files.

Table of Contents

1 Automate file tasks with Python

1. Accessing Directory and File Details
2 Understand the file system
3 Navigate the file system with os module
4 Use os module to uncover path and file details
5 Filter path names with glob module
6 Recursively list all files in a directory
7 Understand Python’s new pathlib module
8 Create directories in Python
9 Challenge Count files
10 Solution Count files

2. Processing Files
11 Open files in Python
12 Read text files in Python
13 Parse JSON files with Python
14 Read CSV files in Python with csv module and pandas
15 Extract text from PDF files using Python
16 Challenge Aggregate data from multiple sources
17 Solution Aggregate data from multiple sources

3. Writing to Files
18 Write data to a file in Python
19 Move and rename files with Python
20 Copy with Python
21 Delete files with Python
22 Save tabular data with csv module
23 Write data to a JSON file in Python
24 Challenge Reorganize digital photo collection
25 Solution Reorganize digital photo collection

4. Working with Archives and Temporary Files
26 Create ZIP archives with Python
27 Read from and extract ZIP archives
28 Open and read TAR archives
29 Extract from and write to TAR archives
30 Work with temporary files in Python

31 Continue to analyze data with Python