Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Testing 18.04
Views: 264
Kernel: Python 3 (Ubuntu Linux)

Monty in Python 3 (Ubuntu Linux) on CoCalc

http://guide.materialsvirtuallab.org/monty

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
c = MSONClass(3, "abc", True, foo="bar")
c.to_json()
'{"@module": "__main__", "@class": "MSONClass", "a": 3, "b": "abc", "c": true, "d": 1, "foo": "bar"}'
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')]