β
import json
from dataclasses import asdict, dataclass
@dataclass
class Stack:
languages : tuple[str, ...] = ("Python", "Bash", "HTML", "CSS")
misc : tuple[str, ...] = ("Docker", "Linux", "FastAPI")
ongoing : tuple[str, ...] = ("Django", "Java", "JavaScript")
def serialize(self):
return json.dumps(asdict(self), indent=4)
stack = Stack()
print(stack.serialize())
print("Hola! Welcome To Safone's World !! π")
β
β
import json
from dataclasses import asdict, dataclass
@dataclass
class Stack:
languages : tuple[str, ...] = ("Python", "Bash", "HTML", "CSS")
misc : tuple[str, ...] = ("Docker", "Linux", "FastAPI")
ongoing : tuple[str, ...] = ("Django", "Java", "JavaScript")
def serialize(self):
return json.dumps(asdict(self), indent=4)
stack = Stack()
print(stack.serialize())
print("Hola! Welcome To Safone's World !! π")
β