質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

Beautiful Soup

Beautiful Soupは、Pythonのライブラリの一つ。スクレイピングに特化しています。HTMLデータの構文の解析を行うために、HTMLタグ/CSSのセレクタで抽出する部分を指定することが可能です。

import

自身のプラットフォーム・プログラム・データセットに対して、外部ソースを取り込むプロセスをimportと呼びます。

OpenCV

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

1167閲覧

抽出したタイトルをエクセル保存したい

zen913

総合スコア21

スクレイピング

スクレイピングとは、公開されているWebサイトからページ内の情報を抽出する技術です。

Beautiful Soup

Beautiful Soupは、Pythonのライブラリの一つ。スクレイピングに特化しています。HTMLデータの構文の解析を行うために、HTMLタグ/CSSのセレクタで抽出する部分を指定することが可能です。

import

自身のプラットフォーム・プログラム・データセットに対して、外部ソースを取り込むプロセスをimportと呼びます。

OpenCV

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

1クリップ

投稿2019/10/07 01:35

プログラミングによって抽出したタイトルをエクセルの一行ごとに保存したいです

python

1import requests, bs4 2 3result = [] 4for num in range(1,4): 5 res = requests.get(f'https://journals.sagepub.com/toc/trjc/88/{num}') 6 res.raise_for_status() 7 soup = bs4.BeautifulSoup(res.text, "html.parser") 8 elems = soup.select('.heading-title') 9 for elem in elems: 10 result.append(elem.text) 11print(*result, sep='\n')

結果

Development of disperse dye polypropylene fiber and process parameter optimization Part I: development of dyeable polypropylene fiber and parameter optimization
Measurement of short fiber contents in raw cotton using dual-beard images
Laccase-mediated in situ polymerization of pyrrole for simultaneous coloration and conduction of wool fabric
Sound absorption of textile curtains – theoretical models and validations by experiments and simulations
Modeling and analysis of the carrier arrangement in three-dimensional circular braiding
Analysis of physical properties and structure design of weft-knitted spacer fabric with high porosity
Novel moisture management test of polyethylene terephthalate and nylon fabric under stretching and surface patterning
High-throughput nanofiber produced by needleless electrospinning using a metal dish as the spinneret
Optimization of durability of Persian hand-knotted wool carpets by using desirability functions
Silk fabrics modification by sol–gel method
The influence of surface hydrophilicity on the adhesion properties of wet fabrics or films to water
The graft polymerization of vinyl benzoate and trans-stilbene onto polyurethane to control its mechanical and shape memory properties
Mathematical analysis of motion control in sectional warping machines
Electrically conducting linen fabrics for technical applications
Effect of treatment temperature on structures and properties of flax rove in supercritical carbon dioxide
Automatic foot scanning and measurement based on multiple RGB-depth cameras
Hydrophilic and antimicrobial properties of acrylic acid and chitosan bigrafted polypropylene melt-blown nonwoven membrane immobilized with silver nanoparticles
Fiber packing density in the cross-section of low torque ring spun yarn
Comparison of airf low environmental effects on thermal fabrics
Geometrical design and forming analysis of three-dimensional woven node structures
Fictitious forces in yarn during unwinding from packages
Numerical simulation of three-dimensional airflow in a novel dual-feed rotor spinning box
The structure and properties of wool treated with a reversed-phase microemulsion containing aqueous alkali
Creation of electro-conductive paths and patterns by screen printing on textile bases
Characterization of functional single jersey knitted fabrics using non-conventional yarns for sportswear
Investigation of the thermal properties of spacer fabrics with bio-ceramic additives using the finite element model and experiment
Study on the coiler drive mechanism of the capacity increasing function
A weaving machine for three-dimensional Kagome reinforcements
Experimental investigation of the tensile and bending behavior of multi-axial warp-knitted fabric composites
Development and testing of controlled adaptive fiber-reinforced elastomer composites

このようにでてきたタイトルをエクセルに保存したいです。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

meg_

2019/10/07 03:53

pythonにてexcelを操作するモジュールがいくつかあるので、調べて好きなものを使えば良いと思います。
guest

回答1

0

ベストアンサー

pythonにて Excelファイルを扱うことができるライブラリを使って Listに格納されたデータ(result) をExcelファイルに書き出すとよいだけかと。

Excelファイルを扱えるライブラリはいくつかありますが、代表的な openyxlxlwtでListをExcelファイルに格納するサンプルコードを書くと以下のようになります。

  • openyxlを使う方法

https://openpyxl.readthedocs.io/en/stable/

Python

1import openpyxl 2result = ['AAA','BBB','CCC'] 3wb = openpyxl.Workbook() 4sheet = wb.active 5for i ,title in enumerate(result, start=1): 6 sheet.cell(row=i, column=1, value=title) 7wb.save('out.xlsx')
  • xlwtを使う方法

https://github.com/python-excel/xlwt

Python

1import xlwt 2result = ['AAA','BBB','CCC'] 3book = xlwt.Workbook() 4sheet1 = book.add_sheet('sheet1') 5for i,title in enumerate(result): 6 sheet1.write(i,0,title) 7book.save("out.xls")

投稿2019/10/07 04:57

magichan

総合スコア15898

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問