maci.loadstrdict

loads maci data from a string as dict

loading data from a string

Loads a string that contains formatted maci data that follows the maci language syntax (See language), and returns the attribute names and data as a dictionary representing them as key/value pairs.

circle-info

maci.loadstrdict -> dict

Basic Example of loading a string using default positional parameter

data = maci.loadstrdict('mydata1 = "data1" \nmydata2 = "data2"')

In this example, we simply load maci formatted data from a string using the loadstrdict function by passing a maci formatted string as an argument to the function, and assign the returned dictionary object data to a variable.

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

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

parameters & arguments

Describes all parameter functionality and accepted data types

chevron-rightmaci_str_data: strhashtag

First and only required positional argument. Accepts strings.

Use this parameter to pass in your maci formatted string data

chevron-rightattr_name_dedup: boolhashtag

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.

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. 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

Last updated