"""File: movie_db.py Purpose: Create and print a database of movies stored as a dictionary Run: python movie_db.py Input: Info on individual movies (see movie.py) Output: List of movies and info """ from movie_d_use import * #---------------------------------------------------------------------- def create_movie_db(): """Create a movie database. Use movie_d module""" m_db = dict() print "Enter the title of the next movie" title = raw_input("(Blank line to quit)\n ") while title != "": movie = create_movie_d(title) m_db[title] = movie print "\nEnter the title of the next movie" title = raw_input("(Blank line to quit)\n ") return m_db #---------------------------------------------------------------------- def print_movie_db(m_db): """Print a movie database. Use movie_d module""" for m in m_db: # m goes through keys in m_db print_movie_d(m_db[m]) #---------------------------------------------------------------------- # Main program if __name__ == "__main__": m_db = create_movie_db() print_movie_db(m_db)