{"id":43020,"date":"2022-10-23T18:40:00","date_gmt":"2022-10-23T09:40:00","guid":{"rendered":"https:\/\/happy-man.jp\/?p=43020"},"modified":"2022-10-22T15:47:16","modified_gmt":"2022-10-22T06:47:16","slug":"post-43020","status":"publish","type":"post","link":"https:\/\/happy-man.jp\/?p=43020","title":{"rendered":"Python\u3067\u65e5\u306e\u51fa\u6642\u523b\u306a\u3069\u6bce\u65e5\u6642\u9593\u304c\u5909\u308f\u308b\u3082\u306e\u306b\u5bfe\u3059\u308b\u6b8b\u308a\u6642\u9593\u3092\u8a08\u7b97\u3057\u3066\u307f\u308b\u3002"},"content":{"rendered":"<p>Python\u306eSchedule\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u306f\u3001\u6bce\u65e5\u306e\u6642\u523b\u306e\u6307\u5b9a\u306f\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u8a08\u7b97\u3057\u305f\u6642\u9593\u3092Schedule\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u7a81\u3063\u8fbc\u3080\u3053\u3068\u306f\u51fa\u6765\u306a\u3044\u3089\u3057\u3044\u3002<\/p>\n<p>\u6bce\u65e5\u5909\u308f\u308b\u6642\u9593\u306b\u306a\u3063\u305f\u3089\u3001\u4f55\u304b\u3092\u3059\u308b\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u308b\u306b\u306f\u3001sleep\u95a2\u6570\u3067\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>\u305d\u3046\u3044\u3046\u308f\u3051\u306a\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u4eca\u5ea6\u306e\u65e5\u306e\u51fa\u307e\u3067\u306e\u6642\u9593\u304c\u3042\u3068\u4f55\u79d2\u3067\u3042\u308b\u304b\u3092\u8a08\u7b97\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u305f\u3002<\/p>\n<p><strong><span style=\"font-size: 12pt;\">1.\u3068\u308a\u3042\u3048\u305a\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u308b<\/span><\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>import time\r\nfrom datetime import datetime\r\n\r\nt = datetime.strptime(\"2022\/10\/22 08:32\", '%Y\/%m\/%d %H:%M')\r\nt2 = (t - datetime.now()).seconds\r\nprint(t2)\r\n\r\ntime.sleep(t2)\r\nprint(\"Hello sleep\")\r\n# Hello sleep<\/code><\/pre>\n<\/div>\n<p>\u3053\u308c\u3092\u52d5\u304b\u3059\u3068\u3002<\/p>\n<p>\u672a\u6765\u306e\u6642\u9593\u304b\u3089\u4eca\u306e\u6642\u9593\u3092\u5f15\u3044\u305f\u3089\u3001\u3042\u3068t2\u79d2\u3067\u3059\u3088\u3068\u8868\u793a\u3057\u3001t2\u304c0\u79d2\u306b\u306a\u308b\u3068\u300cHello sleep\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059<\/p>\n<p>\u76ee\u6a19\u306e\u6642\u9593\u304c\u4eba\u9593\u306e\u8aad\u3081\u308b\u6642\u9593\u3067\u8a18\u8f09\u3057\u3066\u3044\u308b\u306e\u3067\u3001strptime\u3092\u4f7f\u3063\u3066\u8a08\u7b97\u51fa\u6765\u308b\u6570\u5b57\u306b\u3059\u308b\u3002<\/p>\n<p>datetime.now()\u304c\u4eca\u306e\u6642\u9593\u3067\u3001\u305d\u308c\u3092\u5f15\u304d\u7b97\u3057\u3066\u3084\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p><strong><span style=\"font-size: 12pt;\">2\uff0e\u6b21\u306e\u65e5\u306e\u51fa\u306e\u6642\u9593\u307e\u3067\u306e\u6b8b\u308a\u6642\u9593\u3092\u8a08\u7b97\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u308b<\/span><\/strong><\/p>\n<p>\u6b21\u306e\u65e5\u306e\u51fa\u6642\u9593\u3092\u8a08\u7b97\u3059\u308b\u3082\u306e\u306f\u3001\u5148\u65e5\u3084\u3063\u305f\u306e\u3067\u601d\u3044\u51fa\u3059\u3002<\/p>\n<p><a href=\"https:\/\/happy-man.jp\/?p=42979&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=post-42979\">LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+ tweepy+PyEphem\u3067\u660e\u65e5\u306e\u65e5\u306e\u51fa\u3068\u65e5\u306e\u5165\u308a\u6642\u523b\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f &#8211; happyman web<\/a><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-python\" data-lang=\"Python\"><code>import ephem\r\nimport time\r\nfrom datetime import datetime\r\n\r\n#\u65e5\u306e\u51fa\u3068\u65e5\u306e\u5165\u308a\u306e\u5834\u6240\u3092\u8a2d\u5b9a\r\nnagoya = ephem.Observer()\r\nnagoya.lat = '35.1855875'\u00a0\r\nnagoya.lon = '136.8990919'\r\n\r\n#Pyephem \u3067\u4f7f\u7528\u3059\u308b\u6642\u523b\u306f\u3001\u4e16\u754c\u6642\u3067\u8a2d\u5b9a\u3002\r\nnagoya.date = datetime.utcnow()\r\n\r\n#\u592a\u967d\u306e\u65e5\u306e\u51fa\u3092\u8a08\u7b97\r\nsun = ephem.Sun()\r\nsunrise = (ephem.localtime(nagoya.next_rising(sun)))\r\n\r\n#\u65e5\u306e\u51fa\u307e\u3067\u3042\u3068\u4f55\u79d2\u3092\u8a08\u7b97\r\nnow = datetime.now()\r\ntime_second = (sunrise - now).seconds\r\n\r\nprint(time_second)<\/code><\/pre>\n<\/div>\n<p><span style=\"font-size: 1.6rem;\">\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u52d5\u304b\u3059\u3068\u3001\u3042\u3068\u4f55\u79d2\u3068\u3044\u3046\u306e\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u308b\u3002<\/span><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" style=\"border: 2px solid black;\" src=\"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/aa5729cdcbc19b90c3326e8945147299.png?resize=480%2C398&#038;ssl=1\" alt=\"\" width=\"480\" height=\"398\" \/><\/p>\n<p>\u6b8b\u308a\u6642\u9593\u304c\u6de1\u3005\u3068\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p><strong><span style=\"font-size: 12pt;\">3\uff0e\u4eca\u5f8c\u306e\u76ee\u6a19<\/span><\/strong><\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3063\u3066\u65e5\u306e\u51fa\u6642\u9593\u306b\u304f\u3060\u3089\u306a\u3044Tweet\u3092\u5782\u308c\u6d41\u3059\u3088\u3046\u306b\u3057\u305f\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u306eSchedule\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u306f\u3001\u6bce\u65e5\u306e\u6642\u523b\u306e\u6307\u5b9a\u306f\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u8a08\u7b97\u3057\u305f\u6642\u9593\u3092Schedule\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u7a81\u3063\u8fbc\u3080\u3053\u3068\u306f\u51fa\u6765\u306a\u3044\u3089\u3057\u3044\u3002 \u6bce\u65e5\u5909\u308f\u308b\u6642\u9593\u306b\u306a\u3063\u305f\u3089\u3001\u4f55\u304b\u3092\u3059\u308b\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u308b\u306b\u306f\u3001sl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"_lightning_design_setting":[],"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[31,27,141,142],"tags":[],"class_list":["post-43020","post","type-post","status-publish","format-standard","hentry","category-linux-mint","category-liva","category-python","category-tweepy"],"jetpack_publicize_connections":[],"jetpack-related-posts":[{"id":43031,"url":"https:\/\/happy-man.jp\/?p=43031","url_meta":{"origin":43020,"position":0},"title":"\u65e5\u306e\u51fa\u6642\u523b\u3092\u304a\u77e5\u3089\u305b\u3059\u308bTweet\u3092\u5410\u304d\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670824\u65e5","format":false,"excerpt":"\u65e5\u306e\u51fa\u3084\u65e5\u306e\u5165\u308a\u6642\u523b\u306a\u3069\u65e5\u3005\u523b\u3005\u3068\u5909\u308f\u308b\u6642\u9593\u304c\u3084\u3063\u3066\u304d\u305f\u3089Tweet\u3059\u308b\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u305f\u306e\u3067\u5b9f\u88c5\u3057\u307e\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":42979,"url":"https:\/\/happy-man.jp\/?p=42979","url_meta":{"origin":43020,"position":1},"title":"LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+ tweepy+PyEphem\u3067\u660e\u65e5\u306e\u65e5\u306e\u51fa\u3068\u65e5\u306e\u5165\u308a\u6642\u523b\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670821\u65e5","format":false,"excerpt":"\u6bce\u65e5\u6b63\u6642\u306e\u6642\u5831\u3092\u305f\u3060\u6de1\u3005\u3068\u5410\u304d\u51fa\u3059LIVA\u541b\u306a\u3093\u3067\u3059\u304c\u3001\u306a\u3093\u304b\u3082\u3046\u5c11\u3057\u8ce2\u3044\u3068\u3053\u308d\u898b\u3066\u898b\u305f\u3044\u3002 LIV\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/0bbc0f678f9f167b7a2470c8386fc6a1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":43011,"url":"https:\/\/happy-man.jp\/?p=43011","url_meta":{"origin":43020,"position":2},"title":"Python\u306eSchedule\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066Twitter\u306b\u6642\u5831\u3092\u5410\u304d\u51fa\u3057\u3066\u307f\u305f\u3002","author":"happyman","date":"2022\u5e7410\u670822\u65e5","format":false,"excerpt":"Linux\u306b\u306fcron\u304c\u6709\u308b\u3051\u3069\u3082\u3001Windows\u306b\u306fcron\u304c\u306a\u3044\u306e\u3067\u3001Windows\u3067\u5b9a\u6642\u8d77\u52d5\u3055\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/a658ada500911819d41bbaa8bdba9ed0.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":42959,"url":"https:\/\/happy-man.jp\/?p=42959","url_meta":{"origin":43020,"position":3},"title":"LIVA\u541b\uff08LINUX MINT\uff09\u304b\u3089Python+tweepy+cron\u3067\u6642\u5831\u3092\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f","author":"happyman","date":"2022\u5e7410\u670819\u65e5","format":false,"excerpt":"cron\u3067\u6240\u5b9a\u306e\u6642\u9593\u306b\u30c4\u30a4\u30fc\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3089\u6b32\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002 LIVA\u541b\uff08LINUX MIN\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_12-53-46_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":42966,"url":"https:\/\/happy-man.jp\/?p=42966","url_meta":{"origin":43020,"position":4},"title":"TwitterAPI V2\u306e\u30a2\u30af\u30bb\u30b9\u8a8d\u8a3c\u306e\u90e8\u5206\u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3057\u3066\u307f\u305f","author":"happyman","date":"2022\u5e7410\u670820\u65e5","format":false,"excerpt":"\u306a\u3093\u304b\u8abf\u5b50\u3088\u304fLIVA\u541b\u304cTwitterbot\u306b\u306a\u308a\u3064\u3064\u3042\u308b\u306e\u3067\u3059\u304c\u3001Twitter\u306e\u8a8d\u8a3c\u306e\u90e8\u5206\u304c\u90aa\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-38-50_No-00.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-38-50_No-00.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-38-50_No-00.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/happy-man.jp\/wp-content\/uploads\/2022\/10\/SnapCrab_NoName_2022-10-16_13-38-50_No-00.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":43171,"url":"https:\/\/happy-man.jp\/?p=43171","url_meta":{"origin":43020,"position":5},"title":"\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3067\u30b2\u30c3\u30c8\u3057\u305f\u6c17\u8c61\u5e81\u306eAMeDAS\u30c7\u30fc\u30bf\u3092\u8a08\u7b97\u3057\u3066IF\u3092\u4f7f\u3063\u3066\u5224\u5b9a\u3057\u3066\u307f\u305f","author":"happyman","date":"2022\u5e7411\u670815\u65e5","format":false,"excerpt":"Python\u521d\u5fc3\u8005\u304c\u3084\u3063\u3068\u6761\u4ef6\u5206\u5c90\u3092\u3084\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002 \u6c17\u8c61\u5e81\u306e\u767a\u8868\u3057\u3066\u3044\u308b\u6c17\u8c61\u30c7\u30fc\u30bf\u3092Tw\u2026","rel":"","context":"Linux mint","block_context":{"text":"Linux mint","link":"https:\/\/happy-man.jp\/?cat=31"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43020"}],"version-history":[{"count":4,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43020\/revisions"}],"predecessor-version":[{"id":43026,"href":"https:\/\/happy-man.jp\/index.php?rest_route=\/wp\/v2\/posts\/43020\/revisions\/43026"}],"wp:attachment":[{"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/happy-man.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}