MCPcopy Index your code
hub / github.com/python/cpython / write_bytes

Method write_bytes

Lib/pathlib/__init__.py:988–995  ·  view source on GitHub ↗

Open the file in bytes mode, write to it, and close the file.

(self, data)

Source from the content-addressed store, hash-verified

986 return f.read()
987
988 def write_bytes(self, data):
989 """
990 Open the file in bytes mode, write to it, and close the file.
991 """
992 # type-check for the buffer interface before truncating the file
993 view = memoryview(data)
994 with self.open(mode='wb') as f:
995 return f.write(view)
996
997 def write_text(self, data, encoding=None, errors=None, newline=None):
998 """

Callers 2

scriptMethod · 0.95
_write_contentsFunction · 0.45

Calls 2

openMethod · 0.95
writeMethod · 0.45

Tested by 1

scriptMethod · 0.76