Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import pprint
- def readfile(filename):
- """
- Returns the content of a file
- """
- handle = open(filename, 'r')
- data = handle.read()
- handle.close()
- return data
- def jsonfiletodict(filename):
- """
- Returns a dictionary of a JSON file
- """
- plaintext = readfile(filename)
- return json.loads(plaintext)
- def viewallcourses(data):
- """
- Prints courses from a list of dictionaries
- """
- l = []
- for course in courses:
- def main():
- """
- Launchs the app
- """
- loaded_json = jsonfiletodict("metadata.json")
- viewcourses(loaded_json)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement