MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / write_text

Method write_text

tools/python-3.11.9-amd64/Lib/pathlib.py:1070–1079  ·  view source on GitHub ↗

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

(self, data, encoding=None, errors=None, newline=None)

Source from the content-addressed store, hash-verified

1068 return f.write(view)
1069
1070 def write_text(self, data, encoding=None, errors=None, newline=None):
1071 """
1072 Open the file in text mode, write to it, and close the file.
1073 """
1074 if not isinstance(data, str):
1075 raise TypeError('data must be str, not %s' %
1076 data.__class__.__name__)
1077 encoding = io.text_encoding(encoding)
1078 with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
1079 return f.write(data)
1080
1081 def readlink(self):
1082 """

Callers 1

generate_or_checkFunction · 0.45

Calls 2

openMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected