Mars is a lightweight config parser that aims to be simple and understandable
- Save and load data from a file π
- Save files in Plist π
- Save files in JSON πͺ
import mars # Import Mars
conf = mars.generate("fileName.json", mars.types.json) # Set the path of the save file and the save file type
var1 = mars.element("var1", True, conf) # Define the var
var1.set("Hello!") # Change the value
var1.get() # Get the value
If you run the following code you're going to notice that the value Is saved, under the key name var1
:
import mars # Import Mars
conf = mars.generate("fileName.json", mars.types.json) # Set the path of the save file
var1 = mars.element("var1", True, conf) # Define the var
var1.get() # Get the value
You should get "Hello!"
mars.generate("path", mars.types.SOME_TYPE)
mars.element("key", "default_value", genData)
mars.element.get()
-> Return the value of the variable. You could also call the class to get the value.mars.element.set("value")
-> Set the value of the variable.
There are the following types
mars.types.json
mars.types.plist
(NoneType is not suported by plistlib)
That's a good question...
- Simply, copy
mars
to your projects directory and import it.
Or maybe you could...
- Generate a wheel and install it.
And it's done! π