maci.loadattrs
loads maci data from a file into any class/object
loading data from a file
Loads any plain text file that contains formatted maci data that follows the maci language syntax (See language), and loads the attribute names and data into a custom class/object. This is done in-place, so nothing is returned.
This can be very useful to load data back into an object whether already stored or after being stored to a file from the partner function maci.dump.
Basic Example of loading data from file into object using default positional parameters
maci.loadattrs('my.data', my_object)
In this example, we simply load maci formatted data from a file using the loadattrs function and pass a string of the filepath to the file as the first argument to the function, then pass the custom object as the second argument to the function, and the data gets loaded into the object in-place.
Example data inside the file
mydata1 = 'data1'
mydata2 = 2
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
my_object.mydata1
my_object.mydata2
print(my_object.mydata1)
print(my_object.mydata2)
parameters & arguments
Describes all parameter functionality and accepted data types
Last updated