Chapter 2: System Programming Packages

  1. What is the main module that allows us to interact with the Python interpreter?

The system (sys) module.

  1. What is the main module that allows us to interact with the OS environment, filesystem, and permissions?

The operating system (os) module

  1. Which modules and methods are used to list the contents of the current working directory?

The operating system (os) module and the getcwd() method.

  1. Which module is used to execute a command or invoke a process via the call() function?

>>> subprocess.call("cls", shell=True)

  1. What is the approach that we can follow in Python to handle files and manage exceptions in an easy and secure way?

We can use the context manager approach and the with statement. ...

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.