Apr-23-2024, 08:49 AM
Hello,
Some of the files could be Windows (latin1, iso9959-1, cp1252), others could be utf-8.
Is try/except the right way to do it?
Some of the files could be Windows (latin1, iso9959-1, cp1252), others could be utf-8.
Is try/except the right way to do it?
#with open(file, 'r') as f: #with open(file, 'r',encoding='utf-8') as f: #latin1, iso9959-1, cp1252 with open(file, 'r',encoding='latin-1') as f: content_text = f.read() soup = BeautifulSoup(content_text, 'html.parser')Thank you.