Python Write / Create File

To write to a text file in Python, First, open the text file using the open() function. Second, write to the text file using the write() method.

Code :