Created
February 5, 2021 09:45
-
-
Save rodrigo-x/6d57563f7ca16ccf6eb07ac7a49b0ff1 to your computer and use it in GitHub Desktop.
Dataclass example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Dict | |
from dataclasses import dataclass | |
@dataclass() | |
class Carros: | |
nome: str | |
modelo: str | |
distancia_percorrida: str | |
kml: int | |
valor: int | |
def __post_init__(self): | |
self.nome = f'O nome: {self.nome} o modelo: {self.modelo} e a {self.distancia_percorrida}' | |
objeto = Carros('Gol', '1999', '80000km', 10, 5000) | |
print(objeto.nome) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment