f1 = open(“/my_path/my_file.text”, “r”) – ANSWER – to open and read a file
f1 = open(“/my_path/my_file.text”, “w”) – ANSWER – to open and write a file (all previous
material discarded)
f1 = open(“/my_path/my_file.text”, “a”) – ANSWER – to open and add to a file
f1.read() – ANSWER – read a file into a string
f1.write(“hello!”) – ANSWER – writes to a file
f1.readline() – ANSWER – reads next line
f1.close() – ANSWER – closes a file (must always close a file!)
with open(“/my_file…etc) as f: – ANSWER – opens, allows work, and automatically
closes a file
timedelta – ANSWER – time library function to calculate time amounts
from datetime import timedelta – ANSWER – grabs timedelta from the datetime library
import datetime as dt – ANSWER – imports a library as a specified variable
datetime.date.today().month – ANSWER – to print current month (aka .day or .year for
those)
beautiful soup – ANSWER – HTML parsing library
NumPy – ANSWER – scientific computing, matrices, array creation library
pandas – ANSWER – data manipulation and analysis library
pillow (PIL) – ANSWER – work with and manipulate images; python imaging library
pyglet – ANSWER – multimedia / gaming creation library
pytz – ANSWER – time zone data library