{"id":451,"date":"2026-04-19T15:37:34","date_gmt":"2026-04-19T06:37:34","guid":{"rendered":"https:\/\/tool-laboratory.com\/?p=451"},"modified":"2026-04-19T15:37:35","modified_gmt":"2026-04-19T06:37:35","slug":"python-code-runner","status":"publish","type":"post","link":"https:\/\/tool-laboratory.com\/en\/python-code-runner\/","title":{"rendered":"Python\u30b3\u30fc\u30c9\u5b9f\u884c\u30c4\u30fc\u30eb\uff5c\u30d6\u30e9\u30a6\u30b6\u3067\u7c21\u5358\u306bPython\u3092\u52d5\u304b\u3059\uff08\u521d\u5fc3\u8005OK\uff09"},"content":{"rendered":"\n<h2>\ud83d\udc0d Python\u30b3\u30fc\u30c9\u5b9f\u884c\u30c4\u30fc\u30eb<\/h2>\n\n<div class=\"py-box\">\n  <textarea id=\"code\" placeholder=\"Python\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044...\"><\/textarea>\n\n  <button onclick=\"runCode()\">\u5b9f\u884c\u3059\u308b<\/button>\n\n  <div id=\"output\"><\/div>\n  <div id=\"explain\"><\/div>\n<\/div>\n\n<style>\n.py-box{\n  max-width:700px;\n  margin:auto;\n  padding:20px;\n  background:#fff;\n  border-radius:16px;\n  box-shadow:0 10px 25px rgba(0,0,0,0.08);\n}\ntextarea{\n  width:100%;\n  height:150px;\n  padding:10px;\n  border-radius:10px;\n  border:1px solid #ddd;\n}\nbutton{\n  margin-top:10px;\n  width:100%;\n  padding:14px;\n  border:none;\n  border-radius:12px;\n  background:#6366F1;\n  color:#fff;\n}\n#output{\n  margin-top:15px;\n  font-weight:bold;\n}\n#explain{\n  margin-top:10px;\n  color:#555;\n  font-size:14px;\n}\n<\/style>\n\n<script>\nfunction runCode(){\n  let code = document.getElementById(\"code\").value;\n\n  \/\/ \u8d85\u7c21\u6613\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\uff08print\u3060\u3051\u5bfe\u5fdc\uff09\n  let output = \"\";\n\n  let lines = code.split(\"\\n\");\n\n  lines.forEach(line => {\n    if(line.includes(\"print(\")){\n      let match = line.match(\/print\\((.*)\\)\/);\n      if(match){\n        output += match[1].replace(\/['\"]\/g, \"\") + \"<br>\";\n      }\n    }\n  });\n\n  document.getElementById(\"output\").innerHTML = \"\u51fa\u529b:<br>\" + (output || \"\uff08\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u3067\u3059\uff09\");\n\n  \/\/ \u7c21\u6613\u89e3\u8aac\n  if(code.includes(\"for\")){\n    document.getElementById(\"explain\").innerHTML = \"\ud83d\udc49 for\u6587\uff1a\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\";\n  } else if(code.includes(\"if\")){\n    document.getElementById(\"explain\").innerHTML = \"\ud83d\udc49 if\u6587\uff1a\u6761\u4ef6\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5206\u5c90\u3057\u307e\u3059\";\n  } else {\n    document.getElementById(\"explain\").innerHTML = \"\";\n  }\n}\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Python\u30b3\u30fc\u30c9\u3092\u7c21\u5358\u306b\u5b9f\u884c\u3059\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>Python\u306f\u521d\u5fc3\u8005\u304b\u3089\u30d7\u30ed\u307e\u3067\u5e45\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308b\u4eba\u6c17\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002 \u3057\u304b\u3057\u3001\u74b0\u5883\u69cb\u7bc9\u304c\u9762\u5012\u3067\u300c\u3059\u3050\u8a66\u3057\u305f\u3044\u300d\u3068\u3044\u3046\u5834\u9762\u3082\u591a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30c4\u30fc\u30eb\u3067\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067Python\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3060\u3051\u3067\u3001 \u7c21\u5358\u306b\u5b9f\u884c\u7d50\u679c\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3053\u306e\u30c4\u30fc\u30eb\u306e\u7279\u5fb4<\/h3>\n\n\n\n<p>\u30fb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e0d\u8981\u3067Python\u3092\u5b9f\u884c<br>\u30fb\u521d\u5fc3\u8005\u5411\u3051\u306e\u7c21\u5358UI<br>\u30fb\u30b3\u30fc\u30c9\u306e\u52d5\u304d\u3092\u7c21\u5358\u306b\u7406\u89e3\u3067\u304d\u308b<\/p>\n\n\n\n<p>\u5b66\u7fd2\u3084\u30c6\u30b9\u30c8\u306b\u6700\u9069\u306a\u30c4\u30fc\u30eb\u3068\u3057\u3066\u3001\u305c\u3072\u6d3b\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc0d Python\u30b3\u30fc\u30c9\u5b9f\u884c\u30c4\u30fc\u30eb \u5b9f\u884c\u3059\u308b Python\u30b3\u30fc\u30c9\u3092\u7c21\u5358\u306b\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 Python\u306f\u521d\u5fc3\u8005\u304b\u3089\u30d7\u30ed\u307e\u3067\u5e45\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308b\u4eba\u6c17\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002 \u3057\u304b\u3057\u3001\u74b0\u5883\u69cb\u7bc9\u304c\u9762\u5012\u3067\u300c\u3059\u3050\u8a66\u3057\u305f\u3044\u300d\u3068\u3044\u3046\u5834\u9762\u3082\u591a &#8230; <a title=\"Python\u30b3\u30fc\u30c9\u5b9f\u884c\u30c4\u30fc\u30eb\uff5c\u30d6\u30e9\u30a6\u30b6\u3067\u7c21\u5358\u306bPython\u3092\u52d5\u304b\u3059\uff08\u521d\u5fc3\u8005OK\uff09\" class=\"read-more\" href=\"https:\/\/tool-laboratory.com\/en\/python-code-runner\/\" aria-label=\"Read more about Python\u30b3\u30fc\u30c9\u5b9f\u884c\u30c4\u30fc\u30eb\uff5c\u30d6\u30e9\u30a6\u30b6\u3067\u7c21\u5358\u306bPython\u3092\u52d5\u304b\u3059\uff08\u521d\u5fc3\u8005OK\uff09\">Read more<\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-it-tools"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":2,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":454,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/posts\/451\/revisions\/454"}],"wp:attachment":[{"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tool-laboratory.com\/en\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}