Instantly share code, notes, and snippets.

View today_to_midnight_utc.py
import pytz
from datetime import date, datetime, time
def today_to_midnight_utc(local_tz='UTC'):
"""
Returns today's date (local timezone) as a midnight UTC timestamp.
e.g. If date is 04/20/18, and server timezone is America/Los_Angeles:
today_to_midnight_utc(local_tz='America/Los_Angeles')
>> 1524182400
View importcsv.py
import csv
def import_csv(filename=None, import_all_columns=False, columns_to_import=None, remove_duplicates=False):
"""
Add contents of specified columns in .csv file to a list of dictionaries.
:param filename: string
:param import_all_columns: bool
:param columns_to_import: list