I am an infant in the coding world (week 6) and I need some help! My overall goal is to write a program that inputs the file unsorted_fruits.tex, reads it, sorts the list alphabetically, and then writes it out to a file called sorted_fruits.txt.
So far I have my basics (aside from sorting and writing it into the new file)
infile=open("unsorted_fruits.tex", "r")
outfile=open("sorted_fruits.txt","w")
fruit=infile.read(26)
outfile.write(fruit)
unsorted_fruits.sort()
print (fruit)
infile.close()
outfile.close()
However I keep getting the [Errno 2] No such file or directory: 'unsorted_fruits.tex'
The file is definitely saved to my computer. I thought it might be .tex (I wasn't familiar with this format) so I changed the file to .txt. and called the .txt to see if that worked, no luck, so I changed it back to .tex Any help is appreciated, thanks!!