New to coding so my apologies if my code is a mess. I am trying to convert a txt file to a tei file so I can analyze it further but previously I have been using xml to tei. Here is the code I have below and the error message. So I know I need to do something different to get it to analyze a txt file but I’m not sure which way would be the most efficient way to do so. Any help is much appreciated!
with open(“dracula.txt”, “r”, encoding=“utf8”) as input:
soup = bs(input, “txt”)
body = soup.find(“body”)
tei_header = soup.find(“teiHeader”)
title = tei_header.find(“title”).string
with open(“dracula.tei”, “w”) as output:
output.write(body.text)
Error: Couldn’t find a tree builder with the features you requested: txt.