Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import json
  2. import pprint
  3.  
  4. def readfile(filename):
  5.     """
  6.    Returns the content of a file
  7.    """
  8.     handle = open(filename, 'r')
  9.     data = handle.read()
  10.     handle.close()
  11.     return data
  12.  
  13.  
  14. def jsonfiletodict(filename):
  15.     """
  16.    Returns a dictionary of a JSON file
  17.    """
  18.     plaintext = readfile(filename)
  19.     return json.loads(plaintext)
  20.  
  21.  
  22. def viewallcourses(data):
  23.     """
  24.    Prints courses from a list of dictionaries
  25.    """
  26.     l = []
  27.     for course in courses:
  28.        
  29.  
  30.  
  31. def main():
  32.     """
  33.    Launchs the app
  34.    """
  35.     loaded_json = jsonfiletodict("metadata.json")
  36.     viewcourses(loaded_json)
  37.  
  38.  
  39. if __name__ == "__main__":
  40.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement