> For the complete documentation index, see [llms.txt](https://docs.macilib.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.macilib.org/docs/toml/functions/maci.tomldump.md).

# maci.tomldump

### 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 parameter](https://docs.macilib.org/docs/toml/functions/maci.tomldump#append-bool) to change mode).

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

```python
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.&#x20;

### parameters & arguments

Describes all parameter functionality and accepted data types

<details>

<summary>filename:  str | Path</summary>

First required positional argument. Accepts strings and [Path objects](https://docs.python.org/3/library/pathlib.html)

Use this parameter to point to your filepath

</details>

<details>

<summary>data:  dict[str, Any]</summary>

Second required positional argument. Accepts dictionaries

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

</details>

<details>

<summary>append:  bool</summary>

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.

</details>

<details>

<summary>multi_line_str:  bool</summary>

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.

</details>

*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/*](https://pypi.org/project/tomli-w/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.macilib.org/docs/toml/functions/maci.tomldump.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
