Shortcuts

mmengine.fileio.put_text

mmengine.fileio.put_text(obj, filepath, backend_args=None)[source]

Write text to a given filepath with ‘w’ mode.

Note

put_text should create a directory if the directory of filepath does not exist.

Parameters
  • obj (str) – Data to be written.

  • filepath (str or Path) – Path to write data.

  • encoding (str, optional) – The encoding format used to open the filepath. Defaults to ‘utf-8’.

  • backend_args (dict, optional) – Arguments to instantiate the corresponding backend. Defaults to None.

Return type

None

Examples

>>> filepath = '/path/of/file'
>>> put_text('hello world', filepath)
Read the Docs v: v0.4.0
Versions
latest
stable
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.