Using Python to Interact with the Operating System (Coursera)

Offered by Google,
Using Python to Interact with the Operating System (Coursera)

By the end of this course, you’ll be able to manipulate files and processes on your computer’s operating system. You’ll also have learned about regular expressions -- a very powerful tool for processing text files -- and you’ll get practice using the Linux command line on a virtual machine. And, this might feel like a stretch right now, but you’ll also write a program that processes a bunch of errors in an actual log file and then generates a summary file. That’s a super useful skill for IT Specialists to know.

Class Deals by MOOC List - Click here and see Coursera's Active Discounts, Deals, and Promo Codes.

We’ll kick off by exploring how to execute Python locally, and organize and use code across different Python files. We'll then learn how to read and write different types of files, and use subprocesses and input streams. We'll also dive into Bash scripting and regular expressions -- both very powerful tools for anyone working with systems. We'll even touch on automatic testing, which allow us to automate how we check if our code is correct. To finish, we’ll put all this together by using the tools that we’ve acquired to process data and generate automatic reports.
We’ll also explain how to set up your own developer environment in your machine. This is a key step in being able to write and deploy powerful automation tools.

What You Will Learn

  • Setup, configure, and use your own developer environment in Python
  • Manipulate files and processes running on the Operating System using Python
  • Understand and use regular expressions (regex), a powerful tool for processing text files
  • Know when to choose Bash or Python, and create small scripts using Bash

Course 2 of 6 in the Google IT Automation with Python Professional Certificate

Syllabus

WEEK 1
Getting Your Python On
In this module, you’ll learn about the different types of operating systems, and how you can get your python code ready to interact with the operating system. We’ll learn about getting your environment set up and installing additional Python modules that will help you along the way. We’ll rundown interpreted versus compiled language, and how they differ from each other. We’ll dive into the benefits of automation, and point out common pitfalls so you can avoid them. Finally, we’ll learn about Qwiklabs, which will be used for graded assessments.

WEEK 2
Managing Files with Python
In this module, you’ll learn about reading and writing to files and the commands that will enable you to do this. We’ll learn the importance of managing files and how we can navigate through different directories. We’ll understand how to work with files and how there is a layer of abstraction between Python and the operating system. Finally, we’ll dive into learning about CSV files and how to best utilize them.

WEEK 3
Regular Expressions
In this module, you’ll learn about what a regular expression is and why you would use one. We’ll dive into the basics of regular expressions and give examples of wildcards, repetition qualifiers, escapare characters, and more. Next up, we’ll explore advanced regular expressions and deep dive on repetition qualifiers. You’ll tackle new exercises like capturing groups and extracting PIDs using regexes. Finally, we’ll provide a cheat sheet to serve as your go-to guide for regular expressions.

WEEK 4
Managing Data and Processes
In this module, we’ll learn about reading and writing to data files based on an interaction with the user. Along the way, we’ll dive into standard streams, environment variables, and command line arguments. Next, we’ll jump into Python subprocesses, including system commands and how they can be used. We’ll review how to obtain output from a system command, and dive into subprocess management, including how to check exit values and manipulate the normal versus error exit values. Finally, we’ll rundown processing log files, and will cover what a log file is, how to filter log files using regular expressions, and how to understand the output captured from log files.

WEEK 5
Testing in Python
In this module, you’ll learn how to create tests in Python. We’ll cover what testing is all about and dive into the differences between manual versus automated testing. Next, we’ll explore what unit tests are intended to do and how to write them. Then, we’ll learn about other test concepts like black box versus white box tests and how test-driven development can frame how you design and write your code. Finally, you’ll learn about errors and exceptions, and how to combat them.

WEEK 6
Bash Scripting
In this module, you’ll be exposed to what the Linux OS has to offer and you'll learn about Bash scripting. We’ll go over basic Linux commands and explore the many processes Linux has to offer, including a key concept called redirection. We’ll then deep dive into creating bash scripts using variables and globs. Finally, we’ll learn about advanced bash concepts and develop an understanding of when to use bash versus Python.

WEEK 7
Final Project
In this module, you’ll put everything you’ve learned so far into action! You’ll apply your scripting knowledge to tackle a challenging final project: writing a script that scans for a specific error in the log files.
You'll create a problem statement to understand the challenge, conduct some research to see what options are available, then begin planning how you intend to solve the problem. Lastly, you'll write the code to implement your solution!

Go to Class
MOOC List is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Related Courses

Machine Learning for Accounting with Python (Coursera) Coursera
University of Illinois at Urbana-Champaign

Machine Learning for Accounting with Python (Coursera)

This course, Machine Learning for Accounting with Python, introduces machine learning algorithms (models) and their applications in accounting problems. It covers classification, regression, clustering, text analysis, time series analysis. It also discusses model evaluation and model optimization. This course provides an entry point for students to be able to apply proper machine learning models on business related datasets with Python to solve various problems.

Sep 21st 2026
5-12 Weeks
Programando con Java para aplicaciones Android (Coursera) Coursera
Universidad Nacional Autónoma de México

Programando con Java para aplicaciones Android (Coursera)

¡Aprende lo mejor de Java para el desarrollo en Android! Descubre lo necesario para construir tus aplicaciones móviles de una forma sencilla, objetiva y práctica. A lo largo del curso, verás diversos ejemplos para crear tu primer Hola Mundo y practicarás la programación orientada a objetos.

Sep 21st 2026
3 Weeks
Development of Real-Time Systems (Coursera) Coursera
EIT Digital

Development of Real-Time Systems (Coursera)

This course is intended for the Master's student and computer engineer who likes practical programming and problem solving! After completing this course, you will have the knowledge to plan and set-up a real-time system both on paper and in practice. The course centers around the problem of achieving timing correctness in embedded systems, which means to guarantee that the system reacts within the real-time requirements.

Sep 21st 2026
5-12 Weeks
VLSI CAD Part II: Layout (Coursera) Coursera
University of Illinois at Urbana-Champaign

VLSI CAD Part II: Layout (Coursera)

A modern VLSI chip is a remarkably complex beast: billions of transistors, millions of logic gates deployed for computation and control, big blocks of memory, embedded blocks of pre-designed functions designed by third parties (called “intellectual property” or IP blocks). How do people manage to design these complicated chips? Answer: a sequence of computer aided design (CAD) tools takes an abstract description of the chip, and refines it step-wise to a final design.

Sep 21st 2026
5-12 Weeks
Java程序设计 (Coursera) Coursera
Peking University

Java程序设计 (Coursera)

《Java程序设计》课程是使用Java语言进行应用程序设计的课程,针对各专业的大学本科生开设。课程的主要目标有三: 一、掌握Java语言的语法,能够较为深入理解Java语言机制,掌握Java语言面向对象的特点。 二、掌握JavaSE中基本的API,掌握在集合、线程、输入输出、图形用户界面、网络等方面的应用。三、能够编写有一定规模的应用程序,养成良好的编程习惯,会使用重构、设计模式、单元测试、日志、质量管理工具提高代码的质量。 对于学过“计算机基础、计算概论或C语言的学生”尤为适用。

Sep 21st 2026
5-12 Weeks
Aprenda a ensinar programação com o Programaê! (Coursera) Coursera
Fundação Lemann,Fundação Telefônica

Aprenda a ensinar programação com o Programaê! (Coursera)

O curso "Aprenda a ensinar programação com o Programaê!" tem como objetivo apoiar professores no desenvolvimento de suas aulas com o ‘Programaê!’, um movimento que quer aproximar a programação do cotidiano de jovens de todo o Brasil por meio de um portal prático, agregador de ideias, soluções, dicas e planos de aula estruturados para professores.

Sep 21st 2026
3 Weeks
Programação para todos (Conceitos básicos de Python) (Coursera) Coursera
University of Michigan

Programação para todos (Conceitos básicos de Python) (Coursera)

Este curso tem como objetivo ensinar a todos os conceitos básicos de programação de computadores usando Python. Abordamos o básico de como criar um programa a partir de uma série de instruções simples em Python. O curso não tem pré-requisitos e evita tudo, exceto a matemática mais simples. Qualquer pessoa com experiência moderada em computadores deve ser capaz de dominar os materiais deste curso. Este curso abordará os capítulos 1 ao 5 do livro “Python para Todos”.

Sep 21st 2026
5-12 Weeks
Programming for Data Science (Coursera) Coursera
University of Leeds

Programming for Data Science (Coursera)

Explore the basics of programming and familiarise yourself with the Python language. After completing this course, you will be able to write Python programs in Jupyter Notebook and describe basic programming. In this course, you will learn everything you need to start your programming journey. You will discover the different data types available in Python and how to use them, learn how to apply conditional and looping control structures, and write your own functions.

Sep 21st 2026
3 Weeks
Machine Learning: Concepts and Applications (Coursera) Coursera
University of Chicago

Machine Learning: Concepts and Applications (Coursera)

This course gives you a comprehensive introduction to both the theory and practice of machine learning. You will learn to use Python along with industry-standard libraries and tools, including Pandas, Scikit-learn, and Tensorflow, to ingest, explore, and prepare data for modeling and then train and evaluate models using a wide variety of techniques. Those techniques include linear regression with ordinary least squares, logistic regression, support vector machines, decision trees and ensembles, clustering, principal component analysis, hidden Markov models, and deep learning.

Sep 21st 2026
5-12 Weeks