MCPcopy Create free account
hub / github.com/ActiveState/code / readFile

Function readFile

recipes/Python/572181_Unicode_String_Hex_Dump/recipe-572181.py:47–50  ·  view source on GitHub ↗
(path, encoding, errors="replace")

Source from the content-addressed store, hash-verified

45
46""" read unicode string from encoded file """
47def readFile(path, encoding, errors="replace"):
48 raw = open(path, 'rb').read()
49 uniText = raw.decode(encoding, errors)
50 return uniText
51
52""" write unicode string to encoded file """
53def writeFile(path, uniText, encoding, errors="replace"):

Callers 1

testFunction · 0.70

Calls 3

openFunction · 0.50
readMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected