Python reads file as string
Refer to this
/nanjunxiao/article/details/9086079
If the file content is not very large, you can read it directly
import os
def read_file_as_str(file_path):
# Determine the path file exists
if not (file_path):
raise TypeError(file_path + " does not exist")
all_the_text = open(file_path).read()
# print type(all_the_text)
return all_the_text