I am trying to call a function- write_corpus_to_file, however when I run the program I get the error code 'Attribute error: List has no attribute 'txt''. I am a python beginner, can anyone help?
THE FUNCTION:
def write_corpus_to_file(mycorpus, myfile):
f = open(myfile, 'w')
newcorpus = ''.join(mycorpus)
f.write(newcorpus)
f.close()
SECTION OF THE MAIN LOOP:
elif user_input=="a":
addseq = input("Enter new input to corpus ")
tidy_text(addseq)
extcorpus = corpus.extend(addseq)
write_corpus_to_file(extcorpus, corpus.txt)
myfileshould be a string, not a variable name. Socorpus.txtshould really be"corpus.txt"