How to create a text file in Python

Creating a text file adds a new file to the filesystem with a specified name.

Solution for How to create a text file in Python : You can use open() to create a new text file Call open(file_name, mode) with mode as “w” to create a new file named file_name in the current directory.


how-to-create-a-text-file-in-python