MCPcopy Index your code
hub / github.com/python-openxml/python-docx / read_str

Method read_str

src/docx/image/helpers.py:52–63  ·  view source on GitHub ↗

Return a string containing the `char_count` bytes at the file position determined by self._base_offset + `base` + `offset`.

(self, char_count, base, offset=0)

Source from the content-addressed store, hash-verified

50 return self._read_int(fmt, base, offset)
51
52 def read_str(self, char_count, base, offset=0):
53 """Return a string containing the `char_count` bytes at the file position
54 determined by self._base_offset + `base` + `offset`."""
55
56 def str_struct(char_count):
57 format_ = "%ds" % char_count
58 return Struct(format_)
59
60 struct = str_struct(char_count)
61 chars = self._unpack_item(struct, base, offset)
62 unicode_str = chars.decode("UTF-8")
63 return unicode_str
64
65 def seek(self, base, offset=0):
66 location = self._base_offset + base + offset

Calls 1

_unpack_itemMethod · 0.95