Trying to capital first letter in line of wordlist and export to new file name = output

Viewed 23

I'm trying to capitalize the first letter in every line of this file which is a wordlist and then export it to new file name = output but when I submit script to print the file is empty and all I get to print via terminal is the first word can someone help me please

Thanks I'm new at this but trying real hard to learn to script on my own it's been about a week of trying different variations but I always get the same result lol

However I can get it to print the whole list via terminal but it does seem to kill before finishing the list !

Thanks for any help

This is my script :

 input = ("f","r")
 output = ("f","w")

 with open ("file1.txt","r") as f, open ("file2.txt","w") as output:
   For x in f:
      For words in f:
        Words = x.capitalize()    
   Print (words)
   Print (output)
1 Answers
with open ("file1.txt","r") as f, open ("file2.txt","w") as output:
    for x in f.readlines():
        output.write(x.capitalize())
Related