Open in CoCalc with one click!

Monty in Python 3 (Ubuntu Linux) on CoCalc

http://guide.materialsvirtuallab.org/monty

In [1]:
from monty.json import MSONable class MSONClass(MSONable): def __init__(self, a, b, c, d=1, **kwargs): self.a = a self.b = b self._c = c self._d = d self.kwargs = kwargs
In [3]:
c = MSONClass(3, "abc", True, foo="bar")
In [8]:
c.to_json()
'{"@module": "__main__", "@class": "MSONClass", "a": 3, "b": "abc", "c": true, "d": 1, "foo": "bar"}'
In [ ]:
In [ ]:
In [11]:
from monty.itertools import chunks import string list(chunks(string.ascii_uppercase, 7))
[('A', 'B', 'C', 'D', 'E', 'F', 'G'), ('H', 'I', 'J', 'K', 'L', 'M', 'N'), ('O', 'P', 'Q', 'R', 'S', 'T', 'U'), ('V', 'W', 'X', 'Y', 'Z')]
In [ ]: