WGU C859 Python Test 2023

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

Leave a Comment

Scroll to Top