Time for action - employee management
In this short and rather contrived example, we'll handle some simple employee records and just print them to the screen. Along the way, however, we'll cover the various different ways a developer can quote and define string literals. A literal is a value that is explicitly entered, and not computed.
- From within our text processing virtual environment, create a new file and name it
- Enter the following code:
import sys import re class BadEmployeeFormat(Exception): """Badly formatted employee name""" def get_employee(): """ Retrieve user information. This method simply prompts the user for an employee's name and his current job title. """ employee = raw_input('Employee Name: ') role = raw_input("Employee's ...