Hi Guys, I am new at Python coding. I am looking for guidance with 2 word file content comparison.
I could read file content with below docx library.
I am getting confused about reading e.g. 10 Headers from file1 and compare with 10 Headers from file2 and check if both files have same number of Headers.
How do I identify and store paragraphs read? Do I use dictionary for storage and string comparison?
Please guide.
I could read file content with below docx library.
I am getting confused about reading e.g. 10 Headers from file1 and compare with 10 Headers from file2 and check if both files have same number of Headers.
How do I identify and store paragraphs read? Do I use dictionary for storage and string comparison?
Please guide.
import docx def Read_File(filename): doc = docx.Document(filename) completedText =[] for paragraph in doc.paragraphs: completedText.append(paragraph.text) return '\n' .join(completedText) file1 = Read_File('UpdatedFile.docx') file2 = Read_File('template.docx') print (file1) print (file2)