Created
December 8, 2017 02:43
-
-
Save hrsano645/f06035de7546bee20184bd7e0d5bb94b to your computer and use it in GitHub Desktop.
python3の日本語でクラスを作った話
This file contains 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
class 日本語挨拶: | |
def __init__(self, 名前): | |
self.名前 = 名前 | |
def 朝(self): | |
print("{}さん おはようございます".format(self.名前)) | |
def 昼(self): | |
print("{}さん こんにちは!".format(self.名前)) | |
def 晩(self): | |
print("{}さん こんばんは".format(self.名前)) | |
def はまちちゃん(self): | |
ref:https://ja.wikipedia.org/wiki/はまちや2 | |
print("{}さん こんにちはこんにちは!".format(self.名前)) | |
挨拶 = 日本語挨拶("sano") | |
挨拶.朝() | |
挨拶.昼() | |
挨拶.晩() | |
挨拶.はまちちゃん() | |
print(dir(挨拶)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment