Skip to Content
Python Automation Cookbook - Second Edition
book

Python Automation Cookbook - Second Edition

by Jaime Buelta
May 2020
Intermediate to advanced content levelIntermediate to advanced
526 pages
10h 31m
English
Packt Publishing
Content preview from Python Automation Cookbook - Second Edition

4

Searching and Reading Local Files

In this chapter, we will introduce the basic operations to read information from files, starting with searching and opening files stored in different directories and subdirectories. Then, we'll describe some of the most common file types and how to read them, including formats such as raw text files, PDFs, and Word documents.

The last recipe will search for a word inside different kinds of files, recursively in a directory tree.

In this chapter, we'll cover the following recipes:

  • Crawling and searching directories
  • Reading text files
  • Dealing with encodings
  • Reading CSV files
  • Reading log files
  • Reading file metadata
  • Reading images
  • Reading PDF files
  • Reading Word documents
  • Scanning documents for a keyword

We will ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Automation Cookbook

Python Automation Cookbook

Jaime Buelta

Publisher Resources

ISBN: 9781800207080Supplemental Content