# maci.loadstr

### loading a string

Loads a string that contains maci data that follows the maci language syntax (See [language](/docs/maci/language.md)), and returns a [MaciDataObj](/docs/maci/object.md).

{% hint style="info" %}
maci.loadstr  ->  [MaciDataObj](/docs/maci/object.md)
{% endhint %}

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

```python
data = maci.loadstr('mydata1 = "data1" \nmydata2 = "data2"')
```

In this example, we simply load maci data from a string using the loadstr function passing a maci formatted string as the first argument to the function to load the maci data, and assign the returned data object to a variable.&#x20;

Access the data by their individual and respective attribute names like you normally would on an object in python.

*Example accessing and viewing the data*

```python
data.mydata1
data.mydata2
print(data.mydata1)
print(data.mydata2)
```

You may also view all maci data simply by printing or viewing the repr of the object (See [object](/docs/maci/object.md))

### parameters & arguments

Describes all parameter functionality and accepted data types

<details>

<summary>maci_str_data:  str</summary>

First and only required positional argument. Accepts strings.

Use this parameter to pass in your maci formatted string data

</details>

<details>

<summary>attr_name_dedup:  bool</summary>

Optional parameter. Accepts booleans. Default = True

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

This feature protects against having duplicate attribute names loaded from a string.  This is helpful if a name has already been defined in the string previously and you do not want it to be overwritten accidentally. This ensures attribute names are unique in your string especially when loading large data sets having thousands of names where it may be hard to keep track. \
\
It will also protect against re-assigning an already existing method name in the maci data object.\
\
You may disable this feature by setting this parameter to False if you need names to be overwritten, but it is recommended to leave it on and write names uniquely.

</details>


---

# Agent Instructions: 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:

```
GET https://docs.macilib.org/docs/maci/functions/maci.loadstr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
