タグ

ブックマーク / qiita.com/shizuma (1)

  • PythonでPPAP - Qiita

    import re ## PPAP class class PPAP(str): def __add__(self, other): self.print_materials(other) result = "{1}-{0}".format(self, other) print("Oh, {0}!".format(result)) return PPAP(result) def __mul__(self, other): match = re.search("(\w+)-(\w+)", other) mate_1, mate_2 = match.group(1), match.group(2) result = "{0}-{1}-{2}".format(mate_2, mate_1, self) print("{0}!!".format(result)) return PPAP(resul

    PythonでPPAP - Qiita
  • 1