I'm trying to make script that generates 26 text files named a.txt, b.txt, and so on up to z.txt. Each file should contain a letter reflecting its filename. So, a.txt will contain letter a, b.txt will contain letter b and so on.
How I need to change this code that it generates .txt files? Now the script is almost correct but it doesn't make .txt files. I'm using Python 3.5. Here is my code:
import string
alphabet= string.ascii_lowercase
for letter in alphabet:
with open(letter,'w') as file:
file.write(letter)