Select Page

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 Project or Idea!?

I am Available for Freelance Projects

I am always looking for opportunities to put my technical skills to work.
I am always looking to connect with like minded people.

Want to connect? – Drop me a message

jamie@jamiestarling.com