"""author: @pythonpips"""

with open('example.txt', mode='w') as txt_file:
    txt_file.write('Hello World from example.txt')

example.txt

Hello World from example.txt
How to Write Text File in Python

Subscribe to our newsletter