maci.tomldump

dumps data to a file as toml

dumping a file

Dumps a dictionary to a file formatted as TOML. Nothing is returned. Creates a new or overwrites an existing file by default (See append parameterarrow-up-right to change mode).

Basic Example of dumping data to a file using default positional parameters

maci.tomldump('mydata.toml', data)

In this example, we simply dump data to a file using the tomldump function and pass a string of the filepath to the file as the first argument to the function, then pass the dictionary data as the second argument to the function.

parameters & arguments

Describes all parameter functionality and accepted data types

chevron-rightfilename: str | Pathhashtag

First required positional argument. Accepts strings and Path objectsarrow-up-right

Use this parameter to point to your filepath

chevron-rightdata: dict[str, Any]hashtag

Second required positional argument. Accepts dictionaries

Use this parameter to pass in the data you want to dump to a file.

chevron-rightappend: boolhashtag

Optional parameter. Accepts booleans. Default = False

Use this parameter to enable appending mode to write by appending data to the file. A new file will be created if the filename does not exist. Default is disabled which writes new or overwrites a file.

chevron-rightmulti_line_str: boolhashtag

Optional parameter. Accepts booleans. Default = False

Use this parameter to enable writing string values as a multiline string. Default behavior is disabled matching the default for the tomli-w library.

This function uses the tomli-w library installed as a dependency from pypi as its underlying functionality. For more information on tomli-w, visit: https://pypi.org/project/tomli-w/arrow-up-right

Last updated