IT 117: Intermediate Scripting
Class 10

General Advice


Review


New Material


Microphone

Questions

Are there any questions before I begin?

Homework 5

I have posted homework 5 here.

It is due this coming Sunday at 11:59 PM.

Today's Class

Today I will discuss two useful Python modules, os and sys.

os lets you talk directly to the operating system from within Python scripts.

sys allows you get get command line arguments and write good usage messages.

General Advice

Read the Material Before Class

Review

The Size of a Set

When Are Sets Equal?

Elements in A Python Set

for Loops with Sets

Testing for Set Membership

Union of Sets in Python

Intersection of Sets in Python

Difference between Sets in Python

Symmetric Difference between Sets in Python

Subsets and Supersets

Disjoint

The clear Method

min And max with Sets

Sets More Efficient Than Lists

Attendance

New Material

Working with the Operating System

The os Module

os.getcwd()

os.listdir(path)

os.chdir(path)

os.rename(old_name, new_name)

os.remove(path)

os.rmdir(path )

os.mkdir(path )

Running Unix Commands within Python

os.environ

The os.path Module

os.path.isfile(path) and os.path.isdir(path)

os.path.basename(path)

The sys Module

Getting Values from the Command Line

Leaving a Running Script

Usage Messages

The platform Module

Class Exercise

Class Quiz