class Data:
def __init__(self, dia, mes, ano):
print("Construindo a data...")
self.dia = dia
self.mes = mes
self.ano = ano
print(f"{self.dia}/{self.mes}/{self.ano}")
def formatada(self):
print(f"{self.dia:02d}/{self.mes:02d}/{self.ano}")
A saida será:
from datas import Data
data1 = Data(1, 6, 2022)
Construindo a data...
1/6/2022
data1.formatada()
01/06/2022