{"id":4538,"date":"2024-11-05T15:28:53","date_gmt":"2024-11-05T06:28:53","guid":{"rendered":"https:\/\/yorozu.cloudfree.jp\/wordpress\/?p=4538"},"modified":"2025-03-28T11:13:01","modified_gmt":"2025-03-28T02:13:01","slug":"%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e6%8c%87%e5%90%91%e3%81%a8python","status":"publish","type":"post","link":"https:\/\/yorozu.cloudfree.jp\/wordpress\/?p=4538","title":{"rendered":"\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u3068Python"},"content":{"rendered":"\n<p>\u5b9f\u884c\u4f8b\u306f\u300cstupa.sarnath\u300d\u306e\u300cGoogle Colabotry\u300d\u74b0\u5883\u306b\u4fdd\u5b58\u3057\u3066\u3042\u308b<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff11\uff0e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u3068\u306f<\/strong><\/h4>\n\n\n\n<p>\u3000\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306f\u3001<br>\u3000\u3000\u3000<strong>\u30c7\u30fc\u30bf\uff08\u5c5e\u6027\uff09<\/strong>\u3068\u305d\u308c\u3092\u64cd\u4f5c\u3059\u308b<strong>\u95a2\u6570\uff08\u30e1\u30bd\u30c3\u30c9\uff09<\/strong>\u3092\u30ab\u30d7\u30bb\u30eb\u5316\u3057\u305f\u3082\u306e<br>\u3000\u3000\u3000\u3000\u3000\u732b\u3068\u3044\u3046\u300c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff1aObject\u300d\u306f<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u767d\u304f\u3066\u5c3b\u5c3e\u304c\u3042\u308b\u3068\u3044\u3046\u300c\u5c5e\u6027\uff1aProperty\u300d<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u624b\u8db3\u304c\uff14\u672c\u3067\u6b69\u304f\u3068\u3044\u3046\u300c\u30e1\u30bd\u30c3\u30c9\uff1aMethod\u300d<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff12\uff0e\u30af\u30e9\u30b9\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/h4>\n\n\n\n<p>\u3000\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u3067\u306f\u3001\u30af\u30e9\u30b9\u3068\u3044\u3046\u3082\u306e\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u3057\u3066\u8a18\u8ff0\u3057\u3066\u304a\u304f<br>\u3000\u3000\u3000\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3044\u305f\u3044\u3068\u304d\u306b\u3001Python\u306e\u6587\u6cd5\u3092\u4f7f\u3063\u3066\u3001<br>\u3000\u3000\u3000\u30af\u30e9\u30b9\u304b\u3089\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308a\u51fa\u3059<br><br>\u3000\u3000\u3000\u4f5c\u3063\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u3053\u3068\u3092\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\uff08\u5b9f\u4f53\uff1aInstance\uff09\u300d\u3068\u8a00\u3046<br>\u3000\u3000\u3000\u3000\u3000\u30af\u30e9\u30b9\u304b\u3089\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308a\u51fa\u3059\u64cd\u4f5c\u306e\u3053\u3068\u3092\u3001<br>\u3000\u3000\u3000\u3000\u3000\u300c\u5b9f\u4f53\u5316\u3059\u308b\u300d\u3068\u304b\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308b\u300d\u3068\u8a00\u3046<br><br>\u3000\u30af\u30e9\u30b9\u3068\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30011\u5bfe\u591a\u306e\u95a2\u4fc2<br>\u3000\u3000\u3000\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u3066\u304a\u3051\u3070\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5e7e\u3064\u3067\u3082\u4f5c\u6210\u3067\u304d\u308b<br><br>\u3000\u732b\u306e\u7d39\u4ecb\u6587\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u300c\u30af\u30e9\u30b9\u300d<br>\u3000\u3000\u3000\u540c\u3058\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u9055\u3046\u5185\u5bb9\u3092\u8a18\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u5404\u732b\u306e\u7d39\u4ecb\u6587\u3092\u4f5c\u6210\u3059\u308b<br><br>\u3000\u5404\u732b\u304c\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u300d\u3067\u3001<br>\u3000\u3000\u3000\u732b\u306e\u7d39\u4ecb\u6587\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3092<strong>\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u300d<\/strong>\u3068\u3044\u3046<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff13\uff0e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u521d\u671f\u5316<\/strong><\/h4>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code># \u30af\u30e9\u30b9\u306e\u5b9a\u7fa9\nclass Neko:\n  def __init__(self, breed, color, tail, neko_skill):\n    self.breed = breed        # \u732b\u7a2e\n    self.color = color # \u6bdb\u306e\u8272\n    self.tail = tail   # \u3057\u3063\u307d\u306e\u6709\u7121\n    self.neko_skill = neko_skill # \u306d\u3053\u6280\u3092\u8a2d\u5b9a\n\n  # \u5c5e\u6027\u306b\u5bfe\u3057\u3066\u64cd\u4f5c\u3092\u884c\u3046\u30e1\u30bd\u30c3\u30c9\u306e\u5b9a\u7fa9\n  def hissatsu(self):\n    print(f&#39;{self.breed}\u306e\u5fc5\u6bba\u6280{self.neko_skill}!&#39;)\n\nneko1 = Neko(&#39;\u30de\u30f3\u30c1\u30ab\u30f3&#39;, &#39;\u771f\u3063\u767d&#39;, &#39;\u9577\u3044&#39;, &#39;\u30cd\u30b3\u30d1\u30f3\u30c1&#39;)\nneko2 = Neko(&#39;\u30b9\u30b3\u30c6\u30a3\u30c3\u30b7\u30e5\u30d5\u30a9\u30fc\u30eb\u30c9&#39;, &#39;\u4e09\u6bdb\u732b&#39;, &#39;\u3075\u3055\u3075\u3055&#39;, &#39;\u30cd\u30b3\u30ad\u30c3\u30af&#39;)\n\n# \u5c5e\u6027\u306e\u78ba\u8a8d\nprint(neko1.color)\nprint(neko2.tail)\n\n# \u30e1\u30bd\u30c3\u30c9\u306e\u78ba\u8a8d\nneko1.hissatsu()\nneko2.hissatsu()<\/code><\/pre><\/div>\n\n\n\n<p>\u3000__init__()&nbsp;\u3092\u4f7f\u7528\u3059\u308b<br>\u3000\u3000\u3000\u4f8b\u3068\u3057\u3066\u3000def __init__(self, breed, color, tail, neko_skill):<\/p>\n\n\n\n<p>\u3000\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u305f\u76f4\u5f8c\u306b\u3001\u521d\u671f\u72b6\u614b\u3092\u8a2d\u5b9a\u3059\u308b<br>\u3000\u3000\u3000\u7279\u6709\u306e\u30c7\u30fc\u30bf\uff08\u5c5e\u6027\uff09\u3092\u5272\u308a\u5f53\u3066\u308b<br>\u3000\u3000\u3000\u3000\u3000\u540c\u3058\u30af\u30e9\u30b9\u306e\u7570\u306a\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u7570\u306a\u308b\u5024\u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u308b<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff14\uff0e<code>self<\/code>\u306e\u4f7f\u7528<\/strong><\/h4>\n\n\n\n<p>\u3000\u7279\u5b9a\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5c5e\u6027\u3084\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b<br>\u3000\u3000\u3000\u4f8b\u3068\u3057\u3066\u3000<code>self.breed<\/code>\u306f\u305d\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e&nbsp;<code>breed<\/code>&nbsp;\u5c5e\u6027\u3092\u6307\u3059<br>\u3000\u3000\u3000\u4f8b\u3068\u3057\u3066\u3000<code>self<\/code>&nbsp;\u3092\u4f7f\u3063\u3066\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306b\u3088\u308a\u3001<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u305d\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u5185\u3067\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b<br>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u30e1\u30bd\u30c3\u30c9\u304c\u305d\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\uff15\uff0e\u30af\u30e9\u30b9\u306e\u7d99\u627f\u3001\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9<\/strong><\/h4>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>class Koneko(Neko):\n    def __init__(self, color, tail, name, neko_skill):\n        super().__init__(&#39;\u30de\u30f3\u30c1\u30ab\u30f3&#39;, color, tail, neko_skill)\n        self.name = name\n\n    # hissatsu\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\n    def hissatsu(self):\n        print(f&#39;{self.color}\u8272\u306e\u8d64\u3061\u3083\u3093\u30de\u30f3\u30c1\u30ab\u30f3\u306e\u5fc5\u6bba\u6280{self.neko_skill}!&#39;)\n\n    # \u65b0\u3057\u3044\u30e1\u30bd\u30c3\u30c9\uff08\u98fc\u3044\u4e3b\u306b\u3054\u3042\u3044\u3055\u3064\uff09\u306e\u8ffd\u52a0\n    def say_hello(self):\n        print(f&#39;\u306f\u3058\u3081\u307e\u3057\u3066\u3002\u30ef\u30bf\u30b7\u306e\u540d\u524d\u306f{self.name}\u3060\u306b\u3083\u3002&#39;)\n\nkoneko = Koneko(&#39;\u30aa\u30d5\u30db\u30ef\u30a4\u30c8&#39;, &#39;\u77ed\u3044&#39;, &#39;\u3057\u308d\u306d\u3053&#39;, &#39;\u306d\u3053\u3058\u3083\u3089\u3057\u653b\u6483&#39;)\n\n#\nprint(koneko.tail)\nprint(koneko.breed)\n\n#\nkoneko.hissatsu()\nkoneko.say_hello()<\/code><\/pre><\/div>\n\n\n\n<p>\u3000super().init\u3092\u4f7f\u7528\u3059\u308b<br>\u3000\u3000\u3000\u89aa\u306e\u30af\u30e9\u30b9\u3092\u547c\u3073\u51fa\u3057\u3066\u4f7f\u7528\u3059\u308b<br><br>\u3000\u30af\u30e9\u30b9\u3082<strong>\u7d99\u627f<\/strong>\u3068\u3044\u3046\u3053\u3068\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b<br>\u3000\u3000\u3000\u7d99\u627f\u5143\u306e\u30af\u30e9\u30b9\u3092\u89aa\u30af\u30e9\u30b9\u3001\u7d99\u627f\u5f8c\u306e\u30af\u30e9\u30b9\u3092\u5b50\u30af\u30e9\u30b9\u3068\u3044\u3046<br><br>\u3000\u30af\u30e9\u30b9\u3092<strong>\u7d99\u627f<\/strong>\u3059\u308b\u3053\u3068\u3067\u3001<br>\u3000\u3000\u3000\u89aa\u30af\u30e9\u30b9\u306e\u7279\u5fb4\u3092\u6301\u3061\u3064\u3064\u5b50\u30af\u30e9\u30b9\u306b\u8ffd\u52a0\u306e\u5c5e\u6027\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u308b<br>\u3000\u3000\u3000\u30e1\u30bd\u30c3\u30c9\u3092\u4e0a\u66f8\u304d\u3057\u305f\u308a\u3001\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b<\/p>\n\n\n\n<p>\u3000\u7d99\u627f\u30fb\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u969b\u306b\u3082&nbsp;self&nbsp;\u304c\u4e00\u5f79\u62c5\u3046<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30fbPython\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u306b\u3064\u3044\u3066<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[17],"class_list":["post-4538","post","type-post","status-publish","format-standard","hentry","category-99_","tag-python"],"_links":{"self":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4538"}],"version-history":[{"count":12,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4538\/revisions"}],"predecessor-version":[{"id":5773,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4538\/revisions\/5773"}],"wp:attachment":[{"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yorozu.cloudfree.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}