1: 2: 3: 4: 5: 6: 7: 8: 9:
filetowrite.write(message.encode("utf-8")) def readfile(readfilename): openfile = open(readfilename, "r") file_contents = openfile.read() #print file_contents openfile.close() return file_contents
import codecs def readfile(readfilename): openfile = codecs.open(readfilename, "r", "utf-8") file_contents = openfile.read() # This is a unicode string print file_contents openfile.close() return file_contents