{"id":4164,"date":"2024-03-24T21:59:13","date_gmt":"2024-03-24T12:59:13","guid":{"rendered":"https:\/\/www.python.ambitious-engineer.com\/?p=4164"},"modified":"2024-03-24T21:59:13","modified_gmt":"2024-03-24T12:59:13","slug":"python%e5%ae%9f%e8%b7%b5%e9%96%8b%e7%99%ba%e5%85%a5%e9%96%80-%e3%81%93%e3%82%8c%e3%81%8b%e3%82%89%e9%96%8b%e7%99%ba%e3%81%99%e3%82%8b%e3%82%b3%e3%83%bc%e3%83%89%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"https:\/\/www.python.ambitious-engineer.com\/archives\/4164","title":{"rendered":"Python\u5b9f\u8df5\u958b\u767a\u5165\u9580 \u3053\u308c\u304b\u3089\u958b\u767a\u3059\u308b\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>\u3067\u306f\u3055\u3063\u305d\u304f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u958b\u767a\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u524d\u8a18\u4e8b\u3067\u8ff0\u3079\u305f\u3068\u304a\u308a\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u96c6\u8a08\u3057\u3066\u7d50\u679c\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3059\u308b\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u3042\u308b\u6848\u4ef6\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8981\u6c42\u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u8907\u6570\u306e\u6570\u5024\u30c7\u30fc\u30bf\u304c\u6539\u884c\u30b3\u30fc\u30c9\u533a\u5207\u308a(\\n)\u3067\u683c\u7d0d\u3055\u308c\u305fUTF-8\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b<\/li>\n<li>\u30e6\u30fc\u30b6\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30fc\u30bf\u306e\u4e2d\u3067\u696d\u52d9\u4e0a\u306e\u95be\u5024100\u3092\u8d85\u3048\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u4ef6\u6570\u3092\u96c6\u8a08\u3057\u3066\u8868\u793a\u3059\u308b<\/li>\n<li>\u5165\u529b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u306f\u30e6\u30fc\u30b6\u30fc\u304c\u5f15\u6570\u3067\u5165\u529b\u3057\u3066\u6307\u5b9a\u3059\u308b<\/li>\n<\/ul>\n<p>\u3053\u308c\u3060\u3051\u3060\u3068\u89e3\u308a\u3065\u3089\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306e\u3067\u52d5\u4f5c\u4f8b\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5165\u529b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u5165\u529b\u30d5\u30a1\u30a4\u30eb\uff1adata.txt<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n98\r\n88\r\n100\r\n120\r\n78\r\n78\r\n121\r\n101\r\n83\r\n64\r\n105\r\n<\/pre>\n<p>\u30e6\u30fc\u30b6\u30fc\u304c\u5b9f\u884c\u3059\u308b\u5834\u5408\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u5f15\u6570\u306b\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npython main.py data.txt\r\n<\/pre>\n<p>\u3053\u306e\u3068\u304d\u96c6\u8a08\u7d50\u679c\u306f120\u3001121\u3001101\u3001105\u306e4\u3064\u304c\u5bfe\u8c61\u306a\u306e\u3067\u51fa\u529b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u51fa\u529b\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n4\r\n<\/pre>\n<p>\u65e9\u901f\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u3068\u308a\u3042\u3048\u305a\u3067\u3059\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport sys\r\n\r\nargs = sys.argv\r\n\r\ndef main():\r\n    print(&quot;\u51e6\u7406\u3092\u958b\u59cb\u3057\u307e\u3059\u3002&quot;)\r\n    input_file = args[1]\r\n\r\n    with open(input_file, &quot;r&quot;) as f1:\r\n        text = f1.read()\r\n        data_list = text.split(&quot;\\n&quot;)\r\n\r\n        result_count = 0\r\n        for row in data_list:\r\n            value = int(row)\r\n            if value &gt; 100:\r\n                result_count += 1\r\n\r\n    print(result_count)\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n\r\n<\/pre>\n<p>\u4eba\u306b\u3088\u3063\u3066\u306f\u6570\u5206\u3067\u66f8\u3051\u308b\u3088\u3046\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002\u30af\u30e9\u30a6\u30c9\u30bd\u30fc\u30b7\u30f3\u30b0\u7b49\u3067\u767a\u6ce8\u3092\u304b\u3051\u308b\u30681\uff5e\u6570\u5343\u5186\u3067\u767a\u6ce8\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u4e00\u65b9\u3001\u30d9\u30f3\u30c0\u30fc\u306b\u3088\u3063\u3066\u306f\u5341\u4e07\u5186\u3092\u8d85\u3048\u308b\u3088\u3046\u306a\u4fa1\u683c\u5e2f\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u500b\u4eba\u3084\u5c11\u4eba\u6570\u3067\u4f7f\u7528\u3059\u308b\u4f7f\u3044\u6368\u3066\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3042\u308c\u3070\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3082\u5168\u304f\u554f\u984c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u30d7\u30ed\u30c0\u30af\u30c8\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3082\u306e\u3092\u958b\u767a\u3059\u308b\u5834\u5408\u306f\u69d8\u3005\u306a\u8003\u616e\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u4e0d\u8db3\u3057\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u8003\u616e\u3059\u3079\u304d\u70b9\u3092\u6b21\u56de\u304b\u3089\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3067\u306f\u3055\u3063\u305d\u304f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u958b\u767a\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u524d\u8a18\u4e8b\u3067\u8ff0\u3079\u305f\u3068\u304a\u308a\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u96c6\u8a08\u3057\u3066\u7d50\u679c\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3059\u308b\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 \u3042\u308b\u6848\u4ef6\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8981\u6c42\u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002 \u8907\u6570\u306e\u6570\u5024\u30c7\u30fc...<\/p>\n","protected":false},"author":1,"featured_media":4162,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[218],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/4164"}],"collection":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/comments?post=4164"}],"version-history":[{"count":3,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/4164\/revisions"}],"predecessor-version":[{"id":4168,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/4164\/revisions\/4168"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media\/4162"}],"wp:attachment":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media?parent=4164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/categories?post=4164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/tags?post=4164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}