Pergunta de entrevista da empresa Infosys

How would you write to a file in Python?