This Python function will read and text file and return the contents.

#usage yourContentHolder = return_text_file_content(path to text file)
def return_text_file_content(file):
    encoding_format = "utf-8"
    textDataFile = open(file, mode="r",encoding= encoding_format)
    textContent = textDataFile.read()
    textDataFile.close()
    return textContent

Usage – yourcontentholder = return_text_file_content(path and file name to text file)


Have a technology project in mind? Let’s talk!

Need a custom technology solution for your business? Please send me an email (jamie@jamiestarling.com) to discuss your project needs.

I can help you get started on the road of building a simple and well-tested working solution, together, with your team.