Hi Tom,
Below is my review of your homework 1.
You did a great job, the program runs and shows what it is supposed to show.
I have a few comments on some parts, which could be done a bit differently.
- The assignment mentions to use json.loads(), instead of json.load()
The difference between them is that json.load() takes a string argument and json.loads() takes file as an object. The documentation on json.loads() is here
https://docs.python.org/2.7/library/json.html#json.loads
- You used parse to parse the data, and it worked great.
However, we were advised to use datetime.datetime.strftime function to convert the string
dates = datetime.datetime.strptime(i, '%Y-%m-%d %H:%M:%S')
the documentation is here
https://docs.python.org/2/library/datetime.html?highlight=datetime.strptime#strftime-and-strptime-behavior
- You didn't close the connection to sqlite3: conn.close() and the files itself json_data.close()
Every time you close the object, you discard memory buffer, what is nothing in this exercise but might be more significant after.
Hope these comments help!
Anna
Hi Tom,
Below is my review of your homework 1.
You did a great job, the program runs and shows what it is supposed to show.
I have a few comments on some parts, which could be done a bit differently.
The difference between them is that json.load() takes a string argument and json.loads() takes file as an object. The documentation on json.loads() is here
https://docs.python.org/2.7/library/json.html#json.loads
However, we were advised to use datetime.datetime.strftime function to convert the string
dates = datetime.datetime.strptime(i, '%Y-%m-%d %H:%M:%S')
the documentation is here
https://docs.python.org/2/library/datetime.html?highlight=datetime.strptime#strftime-and-strptime-behavior
Every time you close the object, you discard memory buffer, what is nothing in this exercise but might be more significant after.
Hope these comments help!
Anna