@JimSkon/

FilmViewStart

Python

No description

fork
loading
Files
  • main.py
  • Film.csv
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
filmFile="Film.csv"

def listAllFilms(filmFile):
  "List the names of the films with each numbered, ignore the first two lines"
  films=open(filmFile,"r",encoding='ISO-8859-1')
  i=0
  for film in films:
    if i>1:
      film=film.strip() # Get rid of "\n"
      parsed=film.split(";")
      print(str(i-1)+". "+parsed[2])
    i+=1

def viewByYear(fileName):
  "List the film name and year for each film"
  year=int(input("What year films would you like to see?"))
  films=open(fileName,"r",encoding='ISO-8859-1')
  for film in films:
    parsed=film.split(";")
    if str(year)==parsed[0]:
      displayFilm(parsed)

def displayFilm(film):
  "Display the info on a film.  Should be expanded"
  print("Film name: "+film[2])
  print("Year: "+film[0])
  print("Subject: "+film[3])


listAllFilms(filmFile)
viewByYear(filmFile)