{"id":20007,"date":"2023-05-26T08:45:22","date_gmt":"2023-05-25T23:45:22","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=20007"},"modified":"2023-06-10T21:36:16","modified_gmt":"2023-06-10T12:36:16","slug":"%e3%80%90python%e3%80%91%e3%82%b9%e3%82%af%e3%83%ac%e3%83%94%e3%83%b3%e3%82%b0%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=20007","title":{"rendered":"\u3010Python\u3011\u4e3b\u6d41\u306e\u30b9\u30af\u30ec\u30d4\u30f3\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea"},"content":{"rendered":"<p>Python\u306e\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e3b\u6d41\u306f\u3001\u4eca\u306f\u5927\u304d\u304f\u4e8c\u3064\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002<\/p>\n<ul>\n<li>Requests +\u00a0BeautifulSoup<\/li>\n<li>Scrapy<\/li>\n<li>Selenium<\/li>\n<\/ul>\n<h2>Requests +\u00a0BeautifulSoup<\/h2>\n<p>JavaScript\u304c\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u9759\u7684\u306a\u30b5\u30a4\u30c8\u3067\u3042\u308c\u3070\u3053\u308c\u3067\u3044\u3051\u307e\u3059\u3002<\/p>\n<h3>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h3>\n<ul>\n<li>homes\u3084suumo\u306a\u3069\u306e\u3088\u3046\u306b\u4e0d\u52d5\u7523\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306a\u3069\u3002<\/li>\n<\/ul>\n<h3>Requests<\/h3>\n<p>Python\u3067HTTP\u901a\u4fe1\u3092\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\u5e73\u305f\u304f\u8a00\u3048\u3070\u3001HTML\u3092\u53d6\u5f97\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001Web\u30da\u30fc\u30b8\u306eURL\u3060\u3051\u3067\u306a\u304fAPI\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001Requests\u306f\u5916\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u306e\u3067pip install\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u305f\u3060\u3001\u3082\u3057Anaconda\u3092\u4f7f\u7528\u3057\u3066\u958b\u767a\u3092\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067Requests\u306f\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u4e0d\u8981\u3067\u3059\u3002\uff09<\/p>\n<h4>urllib\u3068\u6bd4\u8f03\u3057\u3066\u3069\u3046\u304b\uff1f<\/h4>\n<p>urllib\u3067\u3082Requests\u3068\u307b\u307c\u540c\u7b49\u306e\u3053\u3068\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002\u672c\u306b\u3088\u3063\u3066\u306fRequests\u3067\u306f\u306a\u304furllib\u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>urllib\u306b\u6bd4\u3079\u3066Requests\u306e\u65b9\u304c\u3088\u308a\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001urllib\u306fPython\u306e\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u3067pip install\u304c\u4e0d\u8981\u306a\u306e\u304c\u5229\u70b9\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u3082\u3057Anaconda\u3092\u4f7f\u3063\u3066\u304a\u3089\u305a\u3001pip install\u3067\u304d\u306a\u3044\u74b0\u5883\u3067\u3042\u308c\u3070urllib\u306e\u65b9\u304c\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002\uff09<\/p>\n<h3>BeautifulSoup<\/h3>\n<p>Requests\u3067\u53d6\u5f97\u3057\u305fHTML\u3092\u89e3\u6790\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<h2>Scrapy<\/h2>\n<p>\u300cRequests +\u00a0BeautifulSoup\u300d\u306b\u4ee3\u308f\u308b\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3082\u8a00\u308f\u308c\u307e\u3059\u3002\u300cRequests +\u00a0BeautifulSoup\u300d\u3060\u3068\u5225\u3005\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u5fc5\u8981\u3067\u3059\u304c\u3001\u300cScrapy\u300d\u306a\u3089\u3053\u308c\u4e00\u3064\u30ab\u30d0\u30fc\u3067\u304d\u307e\u3059\u3002\u305d\u308c\u3060\u3051\u3067\u306a\u304f\u305d\u308c\u3089\u3092\u4e0a\u56de\u308b\u6a5f\u80fd\u3082\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001JavaScript\u3092\u4f7f\u3063\u3066\u3044\u308b\u30b5\u30a4\u30c8\u3067\u3042\u308c\u3070\u300cscrapy-selenium\u300d\u3068\u3044\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5225\u9014\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>Selenium<\/h2>\n<p>JavaScript\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u96e3\u3057\u3044Web\u30b5\u30a4\u30c8\u304b\u3089\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306b\u8a00\u3048\u3070\u3001\u6700\u8fd1\u306f\u7121\u9650\u30b9\u30af\u30ed\u30fc\u30eb\uff08\u521d\u671f\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3067\u5168\u3066\u306e\u30c7\u30fc\u30bf\u304c\u63cf\u753b\u3055\u308c\u305a\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u305f\u3073\u306b\u63cf\u753b\u3055\u308c\u3066\u3044\u304f\u65b9\u5f0f\uff09\u306e\u30b5\u30a4\u30c8\u304c\u591a\u3044\u3067\u3059\u3002\u305d\u3046\u3057\u305f\u7121\u9650\u30b9\u30af\u30ed\u30fc\u30eb\u306b\u306fJavaScript\u306e\u6280\u8853\u304c\u4f7f\u308f\u308c\u3066\u304a\u308a\u3069\u3046\u3057\u3066\u3082\u9759\u7684\u306aDOM\u64cd\u4f5c\u3060\u3051\u3067\u306f\u5bfe\u5fdc\u3067\u304d\u307e\u305b\u3093\u3002\u81ea\u52d5DOM\u64cd\u4f5c\u3092\u518d\u73fe\u3067\u304d\u308bSelenium\u3067\u306e\u5b9f\u88c5\u306a\u3089\u5b9f\u73fe\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>Selenium\u81ea\u4f53\u306fPython\u72ec\u81ea\u306e\u3082\u306e\u3067\u306f\u306a\u304f\u5c02\u7528\u30c4\u30fc\u30eb\u304c\u3042\u308b\u306e\u3067Python\u306eSelenium\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u306f\u5225\u306b\u30c4\u30fc\u30eb\u3092\u7528\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u3001\u5b9f\u969b\u306e\u30d6\u30e9\u30a6\u30b6\u3067\u64cd\u4f5c\u3059\u308b\u306e\u3067\u52d5\u4f5c\u304c\u9045\u3044\u3053\u3068\u304c\u96e3\u70b9\u3067\u3059\u3002<\/p>\n<h3>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h3>\n<ul>\n<li>\u6c17\u8c61\u5e81\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306a\u3069\u3067\u52d5\u7684\u306b\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u30b5\u30a4\u30c8\u304b\u3089\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408<\/li>\n<li>\u4ed6\u306b\u306fyahoo\u753b\u50cf\u691c\u7d22\u306a\u3069\u306e\u3088\u3046\u306b\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408<\/li>\n<\/ul>\n<h2>\u30c7\u30fc\u30bf\u4fdd\u5b58\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea<\/h2>\n<h3>Pandas<\/h3>\n<p>CSV\u306a\u3069\u306b\u4fdd\u5b58\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059\u3002Python\u306b\u304a\u3044\u3066\u306f\u30b9\u30af\u30ec\u30d4\u30f3\u30b0\u306e\u5206\u91ce\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\uff08\u30c7\u30fc\u30bf\u5206\u6790\uff09\u306e\u5206\u91ce\u306a\u3069\u3067\u3082\u5ea6\u3005\u767b\u5834\u3057\u3066\u304f\u308b\u5229\u7528\u983b\u5ea6\u304c\u9ad8\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<h3>os<\/h3>\n<p>PC\u306b\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3057\u305f\u753b\u50cf\u306a\u3069\u3092\u4fdd\u5b58\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u3044\u307e\u3059\u3002\u4fdd\u5b58\u305d\u306e\u3082\u306e\u3088\u308a\u3082\u4fdd\u5b58\u7528\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u305f\u308a\u3059\u308b\u5834\u5408\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u5916\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u306a\u304f(pip\u306a\u3069\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u7269\u3067\u306f\u306a\u3044)Python\u7d44\u307f\u8fbc\u307f\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u306e\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e3b\u6d41\u306f\u3001\u4eca\u306f\u5927\u304d\u304f\u4e8c\u3064\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002 Requests +\u00a0BeautifulSoup Scrapy Selenium Requests +\u00a0BeautifulSou [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[47],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/20007"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20007"}],"version-history":[{"count":19,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/20007\/revisions"}],"predecessor-version":[{"id":21205,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/20007\/revisions\/21205"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20007"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}