maci.cleanformat
formats data to a cleaner structured output
Formats and dumps dictionaries, lists, tuples, and sets to a string formatted in a clean human-readable structure. Useful for nested data to be represented over multiple lines with indentation.
Basic Example of formatting data to a string using default positional parameter
data = maci.cleanformat(nested_data)
In this example, we simply format nested data to a string using the cleanformat function and pass the data as an argument to the function, and assign the returned string data to a variable.
Example output using cleanformat with nested dictionary data
{
'k1': 'value1',
'k2': {
'sub1': 'sub_value1',
'sub2': {
'sub_sub1': 'sub_sub_value1',
},
'sub3': 'sub_value3',
},
'k3': 'value3',
}
Example output using cleanformat with nested list data
[
1,
[
1,
2,
[
1,
2,
3,
],
3,
],
2,
3,
]
parameters & arguments
Describes all parameter functionality and accepted data types
Last updated