Question from the Python Machine Learning test

How to open a file for writing in Python?