> 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/maci/functions/maci.loaddict.md).

# maci.loaddict

### loading data from a file

Loads any plain text file that contains formatted maci data that follows the maci language syntax (See [language](/docs/maci/language.md)), and returns the attribute names and data as a dictionary representing them as key/value pairs.

{% hint style="info" %}
maci.loaddict  ->  dict
{% endhint %}

*Basic Example of loading a file using default positional parameter*

```python
data = maci.loaddict('my.data')
```

In this example, we simply load maci formatted data from a file using the loaddict function and pass a string of the filepath to the file as the first argument to the function, and assign the returned dictionary object data to a variable.

*Example data inside the file*

<pre><code><strong>mydata1 = 'data1'
</strong>mydata2 = 2
</code></pre>

Access the data by their individual and respective key names like you normally would on a dictionary in python.

*Example accessing and viewing the data*

```python
data['mydata1']
data['mydata2']
print(data['mydata1'])
print(data['mydata2'])
```

### 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>attr_name_dedup:  bool</summary>

Optional parameter. Accepts booleans. Default = False  *(Changed in v1.1.1)*

Use this parameter to enable/disable Attribute Name Deduplication. The default setting is disabled.&#x20;

This feature protects against having duplicate attribute names loaded from a file.  This is helpful if a name has already been defined in the file previously and you do not want it to be overwritten accidentally. This ensures attribute names are unique in your file, especially when loading large data sets having thousands of names where it may be hard to keep track. \
\
You may enable this feature by setting this parameter to True if you need names to not get overwritten. Note: maci internal names may cause name collisions

</details>

<details>

<summary>encoding:  str | None</summary>

Optional parameter. Accepts strings or None. Default = None

Use this parameter to load the data with the desired codec of the encoded data if needed. The default uses the default of python, so you don't have to use this, but you can if the data is using a specific codec.

</details>


---

# 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/maci/functions/maci.loaddict.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.
