I am trying to use .replace and .lstrip on an enumerated list. is there a workaround since it doesnt seem to work on tuples?
for file in onlyfiles:#for file in current directory
with fitz.open(file) as doc: #open the file
text="" #create a blank text variable
for page in doc: # for each page in the file
text += page.get_text() # add the text from the page to the blank text block
text_1 = re.split('\.(?![0-9])', text)
#print(text_1)
words = ['increase','growth']
print(f'File name: {file}')
for word in words:
print(f'Keyword: {word.title()}')
print('')
sentences = [sentence for sentence in text_1 if word.lower() in sentence.lower()]
for sentence in enumerate(sentences, start=1):
print(sentence)
print('')
I would like to be able to remove newline characters. When i added to the print(sentence) line, it told me tuples have no object replace.