We can use the with keyword, which will close the file for us after we’re finished:

with open("phonebook.csv", "a") as file:
    writer = csv.writer(file)
    writer.writerow((name, number))


Another place pass can be used is as a place-holder for a function or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The pass is silently ignored:

def initlog(*args):
...     pass   # Remember to implement this!