{"id":1294,"date":"2017-07-26T09:00:22","date_gmt":"2017-07-26T00:00:22","guid":{"rendered":"http:\/\/www.mizutan.com\/wordpress\/?p=1294"},"modified":"2025-06-10T10:52:22","modified_gmt":"2025-06-10T01:52:22","slug":"post-1294","status":"publish","type":"post","link":"https:\/\/www.mizutan.com\/wordpress\/?p=1294","title":{"rendered":"\u5b9a\u6642\u306b\u30e9\u30ba\u30d1\u30a4\u3092\u4f7f\u3063\u3066\u6642\u523b\u3068\u6a2a\u6d5c\u306e\u5929\u6c17\u4e88\u5831\u3092\u3057\u3083\u3079\u3089\u305b\u3066\u307f\u308b"},"content":{"rendered":"\n<p>openjtalk\u3067raspberrypi\u306b\u304a\u3057\u3083\u3079\u308a\u3092\u3055\u305b\u308b\u6e96\u5099\u306f\u6574\u3044\u307e\u3057\u305f\u3002<br><br><strong>\u4f55\u3092\u3057\u3083\u3079\u3089\u305b\u308b\u304b\u304c\u554f\u984c\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u4e01\u5ea6\u826f\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u898b\u3064\u3051\u305f\u306e\u3067\u3001\u305d\u308c\u3092\u5b9f\u884c<\/strong>\u3057\u3066\u307f\u307e\u3059\u3002<br><br>\u305d\u308c\u304c\u3001\u300craspberrypi\u306b\u6642\u523b\u3068\u5929\u6c17\u3092\u3057\u3083\u3079\u3089\u305b\u308b\u300d\u3053\u3068\u3067\u3059\u3002\u53c2\u8003\u8cc7\u6599\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/raspi.seesaa.net\/article\/415530289.html\" target=\"_blank\" rel=\"noreferrer noopener\">Raspberry Pi\u306b\u73fe\u5728\u6642\u523b\u3068\u3001\u5929\u6c17\u3092\u3057\u3083\u3079\u3089\u305b\u3066\u307f\u305f\uff08Python\uff09<\/a><\/p>\n\n\n\n<p><span data-color=\"#ffff00\" style=\"background: linear-gradient(transparent 60%,rgba(255, 255, 0, 0.7) 0);\" class=\"vk_highlighter\">\u5185\u5bb9\u3092\u5168\u304f\u5909\u3048\u305a\u306b\u3057\u3083\u3079\u3089\u305b\u3066\u3082\u826f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u5730\u57df\u3092\u5909\u3048\u3089\u308c\u308b\u306e\u3067\u3001\u6a2a\u9808\u8cc0\u304b\u3089\u5730\u7406\u7684\u306b\u8fd1\u3044\u300c\u6a2a\u6d5c\u300d\u3067\u3084\u3063\u3066\u307f\u308b<\/span>\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<br><br>\u3055\u3066\u3001\u3069\u3046\u306a\u308b\u3053\u3068\u3084\u3089\u3001<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fe0000\" class=\"has-inline-color\">60\u723a\u304c\u5b9f\u884c\u3059\u308b\u3068\u5fc5\u305a\u4f55\u304b\u304c\u8d77\u3053\u308a\u307e\u3059<\/mark><\/strong>\u304c\u3001\u30a8\u30e9\u30fc\u5bfe\u5fdc\u3092\u542b\u3081\u3066\u3001\u5b9f\u65bd\u5185\u5bb9\u3092\u3054\u89a7\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<br><br>\u5099\u5fd8\u9332\u306b\u3082\u306a\u308b\u306e\u3067\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<!-- www_\u30a4\u30f3\u30c8\u30ed -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"1208333098\"\r\n     data-ad-format=\"rectangle\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u6a2a\u6d5c\u306e\u5929\u6c17\u3092\u558b\u3089\u305b\u308b<\/h2>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30da\u30fc\u30b8\u3067\u3001\u300e\u5730\u57dfID\u306f\u5168\u56fd\u306e\u5730\u70b9\u5b9a\u7fa9\u8868\uff08RSS\uff09 \u306e\u300ccity\u30bf\u30b0\u300d\u306eid\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002\u300f\u3068\u51fa\u3066\u3044\u307e\u3059\u304c\u3001<strong>\u3053\u306e\u30da\u30fc\u30b8\u306b\u884c\u3063\u3066\u3082\u3001\u300ccity\u30bf\u30b0\u300d\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/strong><br><br>60\u723a\u306f\u3001\u3044\u308d\u3044\u308d\u3068\u6307\u5b9a\u30da\u30fc\u30b8\u304b\u3089\u3081\u3050\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u3055\u3063\u3071\u308a\u308f\u304b\u308a\u307e\u305b\u3093\u3002\u7d50\u5c40\u3001\u305f\u3069\u308a\u7740\u3044\u305f\u306e\u304c\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3067\u3059\u3002<br><br><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fe0000\" class=\"has-inline-color\">\u3053\u3053\u306b\u306f\u3001\u4e3b\u3060\u3063\u305f\u90fd\u5e02\u304c\u4e00\u89a7\u3067\u8f09\u3063\u3066\u3044\u308b<\/mark><\/strong>\u306e\u3067\u7c21\u5358\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/www.kaden1000.com\/2013\/04\/livedoor-weather-hacks1%E6%AC%A1%E7%B4%B0%E5%88%86%E5%8C%BA%EF%BC%88city%E3%82%BF%E3%82%B0%EF%BC%89%E3%81%AE%E5%9C%B0%E5%9F%9Fid%E4%B8%80%E8%A6%A7%E3%81%BE%E3%81%A8%E3%82%81\/\" target=\"_blank\" rel=\"noreferrer noopener\">livedoor Weather Hacks API\u3067\u3001\u304a\u5929\u6c17\u30c7\u30fc\u30bf\u306eJSON\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e1\u6b21\u7d30\u5206\u533a\uff08city\u30bf\u30b0\uff09\u306e\u5730\u57dfid\u4e00\u89a7\u307e\u3068\u3081<\/a><\/p>\n\n\n\n<p>\u6a2a\u6d5c\u300c140010\u300d\u3092\u6307\u5b9a\u3057\u3066\u52d5\u304b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pi@raspberrypi:~\/python_pg\/open_jtalk $ python talk_weather.py\n  jsay 7\u670813\u65e5\u300113\u664213\u520632\u79d2\n  jsay &#39;\u795e\u5948\u5ddd\u770c \u6a2a\u6d5c \u306e\u5929\u6c17 \u4eca\u65e5\u306e\u5929\u6c17\u306f\u66c7\u6642\u3005\u6674\u3067\u3059\u3002 \u660e\u65e5\u306e\u5929\u6c17\u306f\u6674\u6642\u3005\u66c7\u3067\u3059\u3002 \u660e\u65e5\u306e\u4e88\u60f3\u6700\u9ad8\u6c17\u6e29\u300131\u5ea6\u3001\u4e88\u60f3\u6700\u4f4e\u6c17\u6e29\u300125\u5ea6\u3067\u3059\u3002&#39;<\/code><\/pre><\/div>\n\n\n\n<p><span data-color=\"#ffff00\" style=\"background: linear-gradient(transparent 60%,rgba(255, 255, 0, 0.7) 0);\" class=\"vk_highlighter\">\u304a\u30fc\u30fc\u3002\u898b\u4e8b\u306b\u52d5\u304d\u307e\u3057\u305f\u306d\u3002\u3061\u3083\u3093\u3068\u3001\u30b9\u30d4\u30fc\u30ab\u304b\u3089\u58f0\u304c\u6d41\u308c\u307e\u3059\u3002<br><\/span><br>\u5f53\u7136\u3067\u3059\u304c\u3001print\u3055\u308c\u3066\u304b\u3089\u58f0\u304c\u51fa\u308b\u307e\u3067\u306b\u6642\u5dee\u306f\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">python3\u3067\u52d5\u304b\u3059<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"481\" height=\"340\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2017\/07\/hanasu.png\" alt=\"\u30e1\u30ac\u30db\u30f3\u3067\u6f14\u8aac\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u306e\u753b\u50cf\" class=\"wp-image-2576\"\/><\/figure>\n<\/div>\n\n\n<p>\u3055\u3066\u3001\u3053\u3053\u307e\u3067\u306f\u4e0a\u8ff0\u306e\u8a18\u4e8b\u306e\u713c\u304d\u76f4\u3057\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-vk-blocks-alert vk_alert alert alert-info\"><div class=\"vk_alert_content\">\n<p>\u305d\u308c\u3060\u3051\u3067\u306f\u3064\u307e\u3089\u306a\u3044\u306e\u3067\u3001\u3053\u3053\u3067\u3001<strong>60\u723a\u306f\u3001\u5c11\u3057\u3067\u3059\u304c\u30aa\u30ea\u30b8\u30ca\u30eb\u306a\u90e8\u5206\u3092\u8ffd\u52a0<\/strong>\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<\/div><\/div>\n\n\n\n<p>Python3\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<br><br><span data-color=\"#ffff00\" style=\"background: linear-gradient(transparent 60%,rgba(255, 255, 0, 0.7) 0);\" class=\"vk_highlighter\">Python\u3068Python3\u3067\u306f\u3001\u30b3\u30fc\u30c9\u306b\u5927\u304d\u304f\u5909\u308f\u3063\u305f\u90e8\u5206\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u624b\u76f4\u3057\u3057\u306a\u304c\u3089\u9032\u3081\u3066\u307f\u305f\u3044<\/span>\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">print\u6587\u3067\u30a8\u30e9\u30fc\u767a\u751f<\/h3>\n\n\n\n<p>\u3055\u3063\u305d\u304f\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pi@raspberrypi:~\/python_pg\/open_jtalk $ python3 talk_weather.py\n  File &quot;talk_weather.py&quot;, line 23  print text  ^  SyntaxError: Missing parentheses in call to &#39;print&#39;<\/code><\/pre><\/div>\n\n\n\n<p>python3\u3067\u306f\u3001print\u6587\u304c\u5927\u304d\u304f\u5909\u308f\u3063\u3066\u3044\u3066\u300c()\u300d\u3067\u304f\u304f\u3089\u306a\u304f\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002print\u6587\u304c\uff12\u7b87\u6240\u3042\u308b\u306e\u3067\u3001\u4e21\u65b9\u3068\u3082\u300c()\u300d\u3067\u304f\u304f\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"8169621401\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n\n\n\n<h3 class=\"wp-block-heading\">urlib2\u304c\u5b58\u5728\u3057\u306a\u3044<\/h3>\n\n\n\n<p>\u4fee\u6b63\u5f8c\u3001\u518d\u5b9f\u884c\u3057\u307e\u3059\u3002<br><br>\u3059\u308b\u3068<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fe0000\" class=\"has-inline-color\">\u65b0\u305f\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f<\/mark><\/strong>\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>Traceback (most recent call last):\n  File &quot;talk_weather.py&quot;, line 9, in &lt;module&gt;\n  import urllib2  ImportError: No module named &#39;urllib2&#39;<\/code><\/pre><\/div>\n\n\n\n<p><span data-color=\"#ffff00\" style=\"background: linear-gradient(transparent 60%,rgba(255, 255, 0, 0.7) 0);\" class=\"vk_highlighter\">Python \u3067\u306f\u300curllib2\u300d\u3092\u4f7f\u3048\u3070\u3088\u3044\u3067\u3059\u304c\u3001Python3\u3067\u306f\u300curllib.request\u300d\u3092\u4f7f\u7528\u3059\u308b<\/span>\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/kaworu.jpn.org\/python\/Python%E3%81%A7urllib2%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%8D%E3%83%83%E3%83%88%E4%B8%8A%E3%81%AE%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95\" target=\"_blank\" rel=\"noreferrer noopener\">\uff08Python\u3067urllib2\u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\uff09<\/a><\/p>\n\n\n\n<p>\u65e9\u3005\u3001\u300curllib2\u300d\u3092\u300curllib.request\u300d\u306b\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">python3\u306funicode\u4f7f\u7528\u4e0d\u53ef\u80fd<\/h3>\n\n\n\n<p>\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u304a\u30fc\u3001\u65e5\u4ed8\u3068\u6642\u9593\u304c print \u3055\u308c\u307e\u3057\u305f\u3002<br><br>\u3088\u30fc\u3057\u3001\u3042\u308c\u3001\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u308b\u305e\u30fb\u30fb\u30fb\u3002<br><br>\u3042\u3001\u307e\u305f\u307e\u305f\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pi@raspberrypi:~\/python_pg\/open_jtalk $ python3 talk_weather.py\n  jsay 7\u670813\u65e5\u300111\u664216\u520614\u79d2\n  Traceback (most recent call last):\n  File &quot;talk_weather.py&quot;, line 68, in &lt;module&gt;\n  main()\n  File &quot;talk_weather.py&quot;, line 16, in main\n  say_weather()\n  File &quot;talk_weather.py&quot;, line 37, in say_weather\n  obj = json.loads( unicode(r.read()) )\n  NameError: name &#39;unicode&#39; is not defined<\/code><\/pre><\/div>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fe0000\" class=\"has-inline-color\">python3\u306funicode\u306e\u4f7f\u7528\u304c\u4e0d\u53ef\u80fd<\/mark><\/strong>\u306a\u3093\u3067\u3059\u3002<br><br>unicode \u3092 str \u306b\u5909\u66f4\u3057\u3066\u518d\u5b9f\u884c\u3057\u307e\u3059\u3002\u307e\u305f\u307e\u305f\u3001\u5909\u306a\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3057\u305f\u306d\u30a8\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pi@raspberrypi:~\/python_pg\/open_jtalk $ python3 talk_weather.py\n  jsay 7\u670813\u65e5\u300111\u664232\u520642\u79d2  Traceback (most recent call last):\n  File &quot;talk_weather.py&quot;, line 68, in &lt;module&gt;\n  main()\n  File &quot;talk_weather.py&quot;, line 16, in main\n  say_weather()\n  File &quot;talk_weather.py&quot;, line 37, in say_weather\n  obj = json.loads( str(r.read()) )\n  File &quot;\/usr\/lib\/python3.4\/json\/__init__.py&quot;, line 318, in loads\n  return _default_decoder.decode(s)\n  File &quot;\/usr\/lib\/python3.4\/json\/decoder.py&quot;, line 343, in decode\n  obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n  File &quot;\/usr\/lib\/python3.4\/json\/decoder.py&quot;, line 361, in raw_decode\n  raise ValueError(errmsg(&quot;Expecting value&quot;, s, err.value)) from None\n  ValueError: Expecting value: line 1 column 1 (char 0)<\/code><\/pre><\/div>\n\n\n\n<p>\u6839\u672c\u7684\u306b unicode \u3092 str \u306b\u5909\u66f4\u3057\u305f\u306e\u304c\u30df\u30b9\u306e\u539f\u56e0\u3067\u3057\u305f\u3002<br><br>\u305d\u3053\u3067\u3001\u3044\u308d\u3044\u308d\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<br><br>\u898b\u3064\u3051\u305f\u306e\u304c\u4e0b\u8a18\u306e\u30da\u30fc\u30b8\u3067\u3059\u3002<br><br>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u6700\u5f8c\u306b decode \u3057\u3066\u307e\u3059\u306e\u3067\u3001 json.loads \u306e\u6240\u3067\u3084\u3063\u3066\u307f\u308b\u3068\u3088\u3055\u305d\u3046\u3067\u3059\u3002<br>\u21d2 <a href=\"https:\/\/qiita.com\/kikuchiTakuya\/items\/53990fca06fb9ba1d8a7\" target=\"_blank\" rel=\"noreferrer noopener\">Python\u3067JSON \u8aad\u307f\u8fbc\u307f<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3088\u3046\u3084\u304f\u30a8\u30e9\u30fc\u53ce\u675f<\/h3>\n\n\n\n<p>\u3055\u3066\u3001say_weather \u306e\u90e8\u5206\u3092\u5207\u308a\u51fa\u3057\u3066\u3001\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>jsay &#39;\u795e\u5948\u5ddd\u770c \u6a2a\u6d5c \u306e\u5929\u6c17 \u4eca\u65e5\u306e\u5929\u6c17\u306f\u66c7\u6642\u3005\u6674\u3067\u3059\u3002 \u660e\u65e5\u306e\u5929\u6c17\u306f\u6674\u6642\u3005\u66c7\u3067\u3059\u3002 \u660e\u65e5\u306e\u4e88\u60f3\u6700\u9ad8\u6c17\u6e29\u300131\u5ea6\u3001\u4e88\u60f3\u6700\u4f4e\u6c17\u6e29\u300125\u5ea6\u3067\u3059\u3002&#39;<\/code><\/pre><\/div>\n\n\n\n<p>\u3061\u3083\u3093\u3068\u51fa\u529b\u3055\u308c\u307e\u3057\u305f\u3002<br><br>\u305d\u308c\u3067\u306f\u3001\u3053\u3053\u3067\u4fee\u6b63\u3057\u305f\u5185\u5bb9\u3092\u672c\u4f53\u306b\u306b\u3082\u65bd\u3057\u307e\u3059\u3002<br><br>\u4fee\u6b63\u3057\u305f\u30bd\u30fc\u30b9\u3067\u518d\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pi@raspberrypi:~\/python_pg\/open_jtalk $ python3 talk_weather_3.py\n  jsay 7\u670814\u65e5\u300122\u664211\u520656\u79d2\n  jsay &#39;\u795e\u5948\u5ddd\u770c \u6a2a\u6d5c \u306e\u5929\u6c17 \u4eca\u65e5\u306e\u5929\u6c17\u306f\u6674\u308c\u3067\u3059\u3002 \u660e\u65e5\u306e\u5929\u6c17\u306f\u6674\u306e\u3061\u66c7\u3067\u3059\u3002 \u660e \u65e5\u306e\u4e88\u60f3\u6700\u9ad8\u6c17\u6e29\u300133\u5ea6\u3001\u4e88\u60f3\u6700\u4f4e\u6c17\u6e29\u300124\u5ea6\u3067\u3059\u3002&#39;<\/code><\/pre><\/div>\n\n\n\n<p class=\"has-medium-font-size\">\u3084\u3063\u305f\u306d\uff01\u3061\u3083\u3093\u3068\u3001\u58f0\u3082\u51fa\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"9186857477\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<p>\u8a02\u6b63\u3057\u305f python3 \u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u203b2020\u5e747\u670831\u65e5livedoor \u304c\u5929\u6c17\u4e88\u5831\u30b5\u30fc\u30d3\u30b9\u306e\u914d\u4fe1\u3092\u505c\u6b62\u3057\u307e\u3057\u305f\u306e\u3067\u3001yahoo!\u5929\u6c17\u306b\u30ea\u30d7\u30ec\u30fc\u30b9\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4ee5\u4e0b\u306e\u8a18\u4e8b\u306b\u63b2\u8f09\u3057\u3066\u3044\u307e\u3059\uff01<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=10106\" target=\"_blank\" rel=\"noreferrer noopener\">\u5929\u6c17\u4e88\u5831\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u505c\u6b62\u306b\u3088\u308b\u5929\u6c17\u4e88\u5831\u30c7\u30fc\u30bf\u8aad\u4e0a\u3052\u30d7\u30ed\u30b0\u30e9\u30e0\u30ea\u30d7\u30ec\u30fc\u30b9\u5b9f\u65bd<\/a><\/li>\n<\/ul>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>#!\/usr\/bin\/env python\n# -*- coding:utf-8 -*-\n\nimport shlex\nimport subprocess\n\nfrom datetime import datetime\n\nimport  urllib.request\nimport json\n\nCMD_SAY = &#39;jsay&#39;\n\ndef main():\n    say_datetime()\n    say_weather()\n    return\n\ndef say_datetime():\n    d = datetime.now()\n    text = &#39;%s\u6708%s\u65e5\u3001%s\u6642%s\u5206%s\u79d2&#39; % (d.month, d.day, d.hour, d.minute, d.second)\n    text = CMD_SAY + &#39; &#39; + text\n    print (text)\n    text = &#39;\/usr\/local\/bin\/&#39; + text\n    print (text)\n    proc = subprocess.Popen(shlex.split(text))\n    proc.communicate()\n    return\n\ndef say_weather():\n    city = &#39;140010&#39;; # Yokohama\n    json_url = &#39;https:\/\/weather.livedoor.com\/forecast\/webservice\/json\/v1&#39; #API URL\n\n    weather_text = u&#39;%s\u306e\u5929\u6c17\u306f%s\u3067\u3059\u3002&#39;\n    temperature_text = u&#39;%s\u306e\u4e88\u60f3\u6700\u9ad8\u6c17\u6e29\u3001%s\u5ea6\u3001\u4e88\u60f3\u6700\u4f4e\u6c17\u6e29\u3001%s\u5ea6\u3067\u3059\u3002&#39;\n\n    try:\n        r =  urllib.request.urlopen(&#39;%s?city=%s&#39; % (json_url, city) )\n        obj = json.loads( r.read().decode(&#39;utf-8&#39;) )\n\n        title = obj[&#39;title&#39;]\n        forecasts = obj[&#39;forecasts&#39;]\n\n        # TODAY\n        cast = forecasts[0]\n        today_w_txt = weather_text % (cast[&#39;dateLabel&#39;], cast[&#39;telop&#39;])\n\n        # TOMMOROW\n        cast = forecasts[1]\n        temperature = cast[&#39;temperature&#39;]\n        tommorow_w_txt = weather_text % (cast[&#39;dateLabel&#39;], cast[&#39;telop&#39;])\n        tommorow_t_txt = temperature_text % (cast[&#39;dateLabel&#39;], temperature[&#39;max&#39;][&#39;celsius&#39;], temperature[&#39;min&#39;][&#39;celsius&#39;])\n\n        # SAY\n        weather_str = title + &#39; &#39; + today_w_txt + &#39; &#39; + tommorow_w_txt + &#39; &#39; + tommorow_t_txt\n        #weather_str = weather_str.encode(&#39;utf-8&#39;)\n\n        text = &#39;&#39;&#39;%s &#39;%s&#39; &#39;&#39;&#39; % (CMD_SAY, weather_str)\n        print (text)\n        proc = subprocess.Popen(shlex.split(text))\n        proc.communicate()\n    finally:\n        r.close()\n\n    return\n\n\n### Execute\nif __name__ == &quot;__main__&quot;:\n    main()<\/code><\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"300\" src=\"https:\/\/www.mizutan.com\/wordpress\/wp-content\/uploads\/2019\/03\/tenki3.jpg\" alt=\"\u5929\u6c17\u4e88\u5831\u306e\u30a4\u30e1\u30fc\u30b8\u753b\u50cf\" class=\"wp-image-7574\"\/><\/figure>\n<\/div>\n\n\n<p>\u6700\u5f8c\u306b\u3001crontab\u3092\u4f7f\u7528\u3057\u3066\u6c7a\u307e\u3063\u305f\u6642\u9593\u306b\u304a\u5929\u6c17\u4e88\u5831\u3092\u558b\u3063\u3066\u3082\u3089\u3046\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>0 8,12,15,20 * * * python3 \/home\/pi\/python_pg\/open_jtalk\/talk_weather_3.py<\/code><\/pre><\/div>\n\n\n\n<p>\u25a0\u601d\u3048\u3070\u3001\u300copenjtalk\u300d\u306e\u8a18\u4e8b\u3082\u5897\u3048\u3066\u304d\u307e\u3057\u305f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=12300\" data-type=\"post\" data-id=\"12300\" target=\"_blank\" rel=\"noreferrer noopener\">openweathermap\u3067python\u306e\u5929\u6c17\u4e88\u5831\u8aad\u4e0a\u3052\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u518d\u30ea\u30d7\u30ec\u30fc\u30b9<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=10106\" data-type=\"post\" data-id=\"10106\" target=\"_blank\" rel=\"noreferrer noopener\">yahoo!\u5929\u6c17\u306erss\u30c7\u30fc\u30bf\u3067python\u306e\u5929\u6c17\u4e88\u5831\u30c7\u30fc\u30bf\u8aad\u4e0a\u3052\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30ea\u30d7\u30ec\u30fc\u30b9<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=1330\" data-type=\"post\" data-id=\"1330\" target=\"_blank\" rel=\"noreferrer noopener\">cron\u3067\u6307\u5b9a\u3057\u305f\u6642\u9593\u306b\u30b3\u30de\u30f3\u30c9\u304c\u6b63\u5e38\u306b\u7a3c\u50cd\u3057\u306a\u3044\u539f\u56e0\u3068\u5bfe\u7b56<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mizutan.com\/wordpress\/?p=1291\" data-type=\"post\" data-id=\"1291\" target=\"_blank\" rel=\"noreferrer noopener\">\u30e9\u30ba\u30d1\u30a4\u3067\u97f3\u58f0\u51fa\u529b\u3092\u8a66\u3059\uff01OpenJtalk\u306e\u6e96\u5099\u304b\u3089\u558b\u308a\u307e\u3067<\/a><\/li>\n<\/ul>\n\n\n\n<!-- WP QUADS v. 2.0.98  Shortcode Ad -->\n<div class=\"quads-location quads-ad\" id=\"quads-ad\" style=\"float:none;margin:0px 0 0px 0;text-align:center;\">\n\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1169427325398969\"\r\n     crossorigin=\"anonymous\"><\/script>\r\n<!-- www_\u8a18\u4e8b\u4e2d\uff13 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-1169427325398969\"\r\n     data-ad-slot=\"8208817721\"\r\n     data-ad-format=\"rectangle\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><br><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading is-style-vk-heading-double_black\">\u6700\u5f8c\u306b<\/h2>\n\n\n\n<p>openjtalk\u3067raspberrypi\u306b\u304a\u3057\u3083\u3079\u308a\u3055\u305b\u308b\u74b0\u5883\u306f\u6574\u3048\u307e\u3057\u305f\u3002<br><br>\u4eca\u56de\u306f\u3001\u305d\u306eraspberrypi\u3092\u4f7f\u3063\u3066\u3001\u6642\u523b\u3068\u6a2a\u6d5c\u306e\u5929\u6c17\u3092\u3057\u3083\u3079\u3089\u305b\u3066\u307f\u307e\u3057\u305f\u3002<br><br>\u5358\u7d14\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30b3\u30d4\u30fc\u3067\u306f\u3064\u307e\u3089\u306a\u3044\u306e\u3067python3\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u3001\u3061\u3087\u3053\u3063\u3068\u30aa\u30ea\u30b8\u30ca\u30eb\u6027\u3092\u6301\u305f\u305b\u307e\u3057\u305f\u3002<br><br>print\u6587\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u540d\u306e\u9055\u3044\u306a\u3069\u304c\u898b\u3089\u308c\u307e\u3057\u305f\u304c\u3001\u3072\u3068\u3064\u305a\u3064\u5bfe\u5fdc\u3057\u3066\u4f55\u3068\u304b\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>openjtalk\u3067raspberrypi\u306b\u304a\u3057\u3083\u3079\u308a\u3092\u3055\u305b\u308b\u6e96\u5099\u306f\u6574\u3044\u307e\u3057\u305f\u3002 \u4f55\u3092\u3057\u3083\u3079\u3089\u305b\u308b\u304b\u304c\u554f\u984c\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u4e01\u5ea6\u826f\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u898b\u3064\u3051\u305f\u306e\u3067\u3001\u305d\u308c\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002 \u305d\u308c\u304c\u3001\u300craspberrypi\u306b\u6642\u523b\u3068 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7577,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[346],"tags":[],"class_list":["post-1294","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openjtalk"],"_links":{"self":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1294"}],"version-history":[{"count":18,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1294\/revisions"}],"predecessor-version":[{"id":32325,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1294\/revisions\/32325"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/7577"}],"wp:attachment":[{"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mizutan.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}