{"id":313,"date":"2014-10-04T22:10:19","date_gmt":"2014-10-04T13:10:19","guid":{"rendered":"http:\/\/chidipy.jpn.com\/topics\/?p=313"},"modified":"2014-10-04T22:10:19","modified_gmt":"2014-10-04T13:10:19","slug":"python3html%e3%83%86%e3%83%b3%e3%83%97%e3%83%ac%e3%83%bc%e3%83%88%e3%81%a8%e3%81%97%e3%81%a6format%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%99%e3%82%8b%e3%82%b3%e3%83%84","status":"publish","type":"post","link":"https:\/\/chidipy.jpn.com\/topics\/?p=313","title":{"rendered":"[python3]HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066format\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u30b3\u30c4"},"content":{"rendered":"<p>python\u3067CGI\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3068\u3001str\u578b(\u6587\u5b57\u5217\u578b)\u306e\u5909\u6570\u306b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u306a\u308bHTML\u3092\u4ee3\u5165\u3057\u3066\u53ef\u5909\u306e\u3068\u3053\u308d\u3060\u3051\u6587\u5b57\u5217\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5316\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u591a\u3044\u304c\u3001python3\u304b\u3089\u672c\u683c\u5c0e\u5165\u3055\u308c\u305fformat\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u66f8\u5f0f\u6307\u5b9a\u90e8\u5206\u304c\u300c%\u300d\u304b\u3089\u300c{}\u300d\u306b\u56f2\u307e\u308c\u3066\u305f\u90e8\u5206\u306b\u5909\u66f4\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001HTML\u4e2d\u306eCSS\u3084JavaScirpt\u3068\u975e\u5e38\u306b\u76f8\u6027\u304c\u60aa\u3044\u3002\uff08{ }\u306e\u9593\u3067\u6539\u884c\u3057\u3066\u3082Key\u3068\u3057\u3066\u8a8d\u8b58\u3055\u308c\u3066\u3057\u307e\u3046\uff09<br \/>\n\u300c%\u300d\u306e\u3068\u304d\u3068\u540c\u69d8\u306b\u540c\u3058\u6587\u5b57\u3092\u91cd\u306d\u305f\u3089\u30a8\u30b9\u30b1\u30fc\u30d7\u3067\u304d\u308b\u304c\uff08\u300c{\u300d\u2192\u300c{{\u300d\uff09\u3001\u3053\u308c\u3092HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4e2d\u3067\u5168\u90e8\u3059\u308b\u3068\u975e\u5e38\u306b\u3081\u3093\u3069\u304f\u3055\u3044\u3057\u53ef\u8aad\u6027\u3082\u60aa\u304f\u306a\u308b\u3002<br \/>\n\u306a\u306e\u3067\u3001\u4eba\u304c\u30b3\u30fc\u30c9\u3092\u8a18\u8f09\u3059\u308b\u3068\u304d\u306e\u30af\u30bb\u306e\u9055\u3044\u3092\u5229\u7528\u3057\u3066\u3001\u5f8c\u304b\u3089\u300c{\u300d\u3092\u300c{{\u300d\u306b\u7f6e\u63db\u3057\u3066\u3057\u307e\u304a\u3046\u3068\u3044\u3046\u4f5c\u6226\u3002<br \/>\n\u5927\u62b5\u306e\u4eba\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30af\u30bb\u306b\u306a\u308b\u3068\u601d\u3046\u3002\uff08\u5b8c\u5168\u306b\u79c1\u611f\uff09<br \/>\npython\u306eformat\u306b\u3088\u308b\u66f8\u5f0f\u6307\u5b9a\uff08{}\u306e\u9593\u306f\u30b9\u30da\u30fc\u30b9\u3092\u7a7a\u3051\u306a\u3044\uff09<\/p>\n<pre>\u00a0'&lt;html&gt;&lt;body&gt;{body}&lt;\/body&gt;&lt;\/html&gt;'.format(body=\"\u4eca\u65e5\u306f\u6674\u5929\u306a\u308a\")<\/pre>\n<p>CSS\/Javascript\uff08\u53ef\u8aad\u6027\u3092\u3042\u3052\u308b\u305f\u3081\u306b{}\u306e\u9593\u306b\u6539\u884c\u3084\u30b9\u30da\u30fc\u30b9\u304c\u5165\u308b\uff09<\/p>\n<pre>\u00a0&lt;html&gt;\n  &lt;head&gt;\n    &lt;style type=\"text\/css\"&gt;\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;!--\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0dt{ backgroud: #bbb }\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0.odd{ backgroud: #ddd }\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--&gt;\n    &lt;\/style&gt;\n    &lt;script type=\"text\/javascript\"&gt;\n       function hogehoge() {\n          print(\"\u672c\u65e5\u306f\u6674\u5929\u306a\u308a\");\n       }\n     &lt;\/script&gt;\n&lt;\/head&gt;<\/pre>\n<p>\u3053\u308c\u3092\u8e0f\u307e\u3048\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3001HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u90e8\u5206\u306f\u6bce\u5ea6\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u306a\u304f\u3066\u3082\u3088\u304f\u306a\u308b\u3002\uff08{}\u3092\u91cd\u306d\u308b\u7f6e\u63db\u3092\u5b9f\u65bd\u3057\u3066\u304b\u3089format\u3092\u3057\u3066\u3044\u308b)<\/p>\n<pre>import re\nhtmltemplate='''\n <em>HTML\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/em>\n'''\nhtml=re.sub(r'([^a-zA-Z0-9])}',r'\\1}}',re.sub(r'{([^a-zA-Z0-9])',r'{{\\1',htmltemplate,0,re.M|re.S),0,re.M|re.S).format(<em>\u66f8\u5f0f\u6307\u5b9a<\/em>)<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>python\u3067CGI\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3068\u3001str\u578b(\u6587\u5b57\u5217\u578b)\u306e\u5909\u6570\u306b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u306a\u308bHTML\u3092\u4ee3\u5165\u3057\u3066\u53ef\u5909\u306e\u3068\u3053\u308d\u3060\u3051\u6587\u5b57\u5217\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5316\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u591a\u3044\u304c\u3001python3\u304b\u3089\u672c\u683c\u5c0e\u5165\u3055\u308c\u305fformat\u30e1\u30bd\u30c3\u30c9\u3067\u306f &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/chidipy.jpn.com\/topics\/?p=313\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;[python3]HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066format\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u30b3\u30c4&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23,24,2,8],"tags":[32,46],"_links":{"self":[{"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=\/wp\/v2\/posts\/313"}],"collection":[{"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":0,"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"wp:attachment":[{"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chidipy.jpn.com\/topics\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}