Comment exporter une chaîne en tant que fichier txt dans Python

text_file = open("sample.txt", "w")
n = text_file.write('Welcome to pythonexamples.org')
text_file.close()
Frantic Ferret