{"id":17613,"date":"2015-07-23T08:00:40","date_gmt":"2015-07-22T23:00:40","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=17613"},"modified":"2015-07-25T08:37:56","modified_gmt":"2015-07-24T23:37:56","slug":"python%e3%81%ae%e3%83%aa%e3%82%b9%e3%83%88%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/17613.html","title":{"rendered":"Python\u306e\u30ea\u30b9\u30c8\u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b"},"content":{"rendered":"<p><a type=\"amzn\" asin=\"4774173207\">Python\u30a8\u30f3\u30b8\u30cb\u30a2\u990a\u6210\u8aad\u672c\uff3b\u3044\u307e\u3069\u304d\u306e\u958b\u767a\u30ce\u30a6\u30cf\u30a6\u6e80\u8f09\uff01\uff3d<\/a>\uff08Kindle\u7248\u306f<a type=\"amzn\" asin=\"B00ZR7WZOU\">Python\u30a8\u30f3\u30b8\u30cb\u30a2\u990a\u6210\u8aad\u672c\uff3b\u3044\u307e\u3069\u304d\u306e\u958b\u767a\u30ce\u30a6\u30cf\u30a6\u6e80\u8f09\uff01\uff3d<\/a>\uff09\u3092\u8aad\u3093\u3060\u308a\u3057\u3066\u3044\u307e\u3059\u3002Raspberry Pi\u3067\u3082Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3059\u308b\u6a5f\u4f1a\u304c\u5897\u3048\u3066\u3044\u307e\u3059\u3002\u3068\u3044\u3046\u3053\u3068\u3067\u3001Python\u3067\u30ea\u30b9\u30c8\u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002<br \/>\n<!--more--><br \/>\nCSV\u30c7\u30fc\u30bf\u306e\u3088\u3046\u306a\u3082\u306e\u306f\u3001split()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u826f\u3044\u306e\u3067\u3059\u306d\u3002\u521d\u671f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u3078\u3001Raspberry Pi\u306eGPIO\u30ea\u30b9\u30c8\u3092 gpio=22,23,24 \u3068\u3044\u3063\u305f\u3088\u3046\u306b\u6307\u5b9a\u3057\u3066\u3001\u305d\u306e\u6587\u5b57\u5217\u3092\u53d6\u5f97\u3057\u305f\u3068\u3057\u307e\u3059\u3002\u305d\u308c\u3092int\u578b\u306e\u30ea\u30b9\u30c8\u3078\u5909\u63db\u3059\u308b\u524d\u306e\u51e6\u7406\u6bb5\u968e\u3068\u3057\u3066\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8[&#8217;22&#8217;, &#8217;23&#8217;, &#8217;24&#8217;]\u3078\u5909\u63db\u3059\u308b\u3068\u304d\u306a\u3069\u306b\u4f7f\u3044\u307e\u3059\u3002int\u578b\u306e\u30ea\u30b9\u30c8\u3078\u5909\u63db\u3059\u308b\u306b\u306f\u3001map\u3068\u304b\u3092\u4f7f\u3046\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u307e\u305f\u5225\u306e\u8a71\u3002\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u30ea\u30b9\u30c8\u3068\u304b\u95a2\u6570\u3068\u304bstr()\u3001int()\u306e\u4f7f\u3044\u65b9\u306e\u78ba\u8a8d\u3082\u542b\u3081\u3066\u3044\u308b\u306e\u3067\u4f59\u8a08\u306a\u30b3\u30fc\u30c9\u304c\u5165\u3063\u3066\u307e\u3059\u3051\u3069\u3001\u81ea\u5206\u7528\u30e1\u30e2\u3068\u3057\u3066\u306f\u3053\u308c\u3050\u3089\u3044\u5165\u3063\u3066\u305f\u307b\u3046\u304c\u4f55\u304b\u3068\u5f8c\u3067\u4fbf\u5229\u306a\u306e\u3067\u5165\u308c\u305f\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n#!\/usr\/bin\/env python\r\n# -*- coding: utf-8 -*-\r\ndef f():\r\n    return [1, 2, 3]\r\n\r\nif __name__ == &#039;__main__&#039;:\r\n    a = f()\r\n    for e in a:\r\n        print str(e)\r\n    v = &#039;22, 23, 24&#039;\r\n    a = v.split(&#039;,&#039;)\r\n    print a\r\n    for e in a:\r\n        print str(int(e))\r\n<\/pre>\n<div>\n<iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=4774173207&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&amp;o=9&amp;p=8&amp;l=as1&amp;asins=B00ZR7WZOU&amp;ref=tf_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr\" height=\"240\" width=\"320\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Python\u30a8\u30f3\u30b8\u30cb\u30a2\u990a\u6210\u8aad\u672c\uff3b\u3044\u307e\u3069\u304d\u306e\u958b\u767a\u30ce\u30a6\u30cf\u30a6\u6e80\u8f09\uff01\uff3d\uff08Kindle\u7248\u306fPython\u30a8\u30f3\u30b8\u30cb\u30a2\u990a\u6210\u8aad\u672c\uff3b\u3044\u307e\u3069\u304d\u306e\u958b\u767a\u30ce\u30a6\u30cf\u30a6\u6e80\u8f09\uff01\uff3d\uff09\u3092\u8aad\u3093\u3060\u308a\u3057\u3066\u3044\u307e\u3059\u3002Raspberry Pi\u3067\u3082Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 &hellip; <a href=\"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/17613.html\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[60,1203],"class_list":["post-17613","post","type-post","status-publish","format-standard","hentry","category-program","tag-python","tag-split"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=17613"}],"version-history":[{"count":6,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17613\/revisions"}],"predecessor-version":[{"id":17627,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/17613\/revisions\/17627"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=17613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=17613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=17613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}