Skip to content

Instantly share code, notes, and snippets.

@hrsano645
Created December 8, 2017 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrsano645/f06035de7546bee20184bd7e0d5bb94b to your computer and use it in GitHub Desktop.
Save hrsano645/f06035de7546bee20184bd7e0d5bb94b to your computer and use it in GitHub Desktop.
python3の日本語でクラスを作った話
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