Python not creating new file open('my_file.txt', 'w')
LordTopley (0)

I'm doing an exercise from a learning Python book and it asks me to import a paragraph from an external text file, split the paragraph into two sentences and write the sentences to two seperate text files.

No errors and everything seems to check out, but why are files now being created?

file_name = open('curiosity_shop.txt', 'r')
file_contents =

first_period = file_contents.find('.')
first_sentence = file_contents[0:first_period+1]
second_sentence = file_contents[first_period+2:]

first_sentence_file = open('first_sentence.txt', 'w')
second_sentence_file = open('second_sentence.txt', 'w')


You are viewing a single comment. View All
nftn (2)

I encountered same problem, and I find that sometimes maybe just refresh your webpage, then you can see the folders and files you just created, pls try, hope this can help you.