質問するログイン新規登録

質問編集履歴

2

内容追記

2020/07/22 04:14

投稿

fukazume
fukazume

スコア78

title CHANGED
File without changes
body CHANGED
@@ -34,4 +34,100 @@
34
34
 
35
35
  ##■環境
36
36
  Windows 10
37
- Python 3.8.3
37
+ Python 3.8.3
38
+
39
+
40
+ ##■CSV出力結果(test.csv)
41
+ ```csv
42
+ "<div class=""content"">
43
+ <div id=""promotions"">
44
+ </div>
45
+ <div id=""content_inner"">
46
+ <article class=""product_page""><!-- Start of product page -->
47
+ <div class=""row"">
48
+ <div class=""col-sm-6"">
49
+ <div class=""carousel"" id=""product_gallery"">
50
+ <div class=""thumbnail"">
51
+ <div class=""carousel-inner"">
52
+ <div class=""item active"">
53
+ <img alt=""A Light in the Attic"" src=""../../media/cache/fe/72/fe72f0532301ec28892ae79a629a293c.jpg""/>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ <div class=""col-sm-6 product_main"">
60
+ <h1>A Light in the Attic</h1>
61
+ <p class=""price_color"">£51.77</p>
62
+ <p class=""instock availability"">
63
+ <i class=""icon-ok""></i>
64
+
65
+ In stock (22 available)
66
+
67
+ </p>
68
+ <p class=""star-rating Three"">
69
+ <i class=""icon-star""></i>
70
+ <i class=""icon-star""></i>
71
+ <i class=""icon-star""></i>
72
+ <i class=""icon-star""></i>
73
+ <i class=""icon-star""></i>
74
+ <!-- <small><a href=""/catalogue/a-light-in-the-attic_1000/reviews/"">
75
+
76
+
77
+ 0 customer reviews
78
+
79
+ </a></small>
80
+ --> 
81
+
82
+
83
+ <!--
84
+ <a id=""write_review"" href=""/catalogue/a-light-in-the-attic_1000/reviews/add/#addreview"" class=""btn btn-success btn-sm"">
85
+ Write a review
86
+ </a>
87
+
88
+ --></p>
89
+ <hr/>
90
+ <div class=""alert alert-warning"" role=""alert""><strong>Warning!</strong> This is a demo website for web scraping purposes. Prices and ratings here were randomly assigned and have no real meaning.</div>
91
+ </div><!-- /col-sm-6 -->
92
+ </div><!-- /row -->
93
+ <div class=""sub-header"" id=""product_description"">
94
+ <h2>Product Description</h2>
95
+ </div>
96
+ <p>It's hard to imagine a world without A Light in the Attic. This now-classic collection of poetry and drawings from Shel Silverstein celebrates its 20th anniversary with this special edition. Silverstein's humorous and creative verse can amuse the dowdiest of readers. Lemon-faced adults and fidgety kids sit still and read these rhythmic words and laugh and smile and love th It's hard to imagine a world without A Light in the Attic. This now-classic collection of poetry and drawings from Shel Silverstein celebrates its 20th anniversary with this special edition. Silverstein's humorous and creative verse can amuse the dowdiest of readers. Lemon-faced adults and fidgety kids sit still and read these rhythmic words and laugh and smile and love that Silverstein. Need proof of his genius? RockabyeRockabye baby, in the treetopDon't you know a treetopIs no safe place to rock?And who put you up there,And your cradle, too?Baby, I think someone down here'sGot it in for you. Shel, you never sounded so good. ...more</p>
97
+ <div class=""sub-header"">
98
+ <h2>Product Information</h2>
99
+ </div>
100
+ <table class=""table table-striped"">
101
+ <tr>
102
+ <th>UPC</th><td>a897fe39b1053632</td>
103
+ </tr>
104
+ <tr>
105
+ <th>Product Type</th><td>Books</td>
106
+ </tr>
107
+ <tr>
108
+ <th>Price (excl. tax)</th><td>£51.77</td>
109
+ </tr>
110
+ <tr>
111
+ <th>Price (incl. tax)</th><td>£51.77</td>
112
+ </tr>
113
+ <tr>
114
+ <th>Tax</th><td>£0.00</td>
115
+ </tr>
116
+ <tr>
117
+ <th>Availability</th>
118
+ <td>In stock (22 available)</td>
119
+ </tr>
120
+ <tr>
121
+ <th>Number of reviews</th>
122
+ <td>0</td>
123
+ </tr>
124
+ </table>
125
+ <section>
126
+ <div class=""sub-header"" id=""reviews"">
127
+ </div>
128
+ </section>
129
+ </article><!-- End of product page -->
130
+ </div>
131
+ </div>"
132
+
133
+ ```

1

誤字訂正

2020/07/22 04:14

投稿

fukazume
fukazume

スコア78

title CHANGED
File without changes
body CHANGED
@@ -6,7 +6,7 @@
6
6
  ・HTMLタグ付き
7
7
  ・CSVの改行コードを"\r\n" に変更することでHTMLソース内の改行\nと区別
8
8
 
9
- しかし、記コードを実行しても、CSVとしてレコードのフィールド内にうまく収まってくれません。
9
+ しかし、記コードを実行しても、CSVとしてレコードのフィールド内にうまく収まってくれません。
10
10
 
11
11
  ```python
12
12
  # -*- coding: utf-8 -*-
@@ -29,4 +29,9 @@
29
29
  ```
30
30
 
31
31
  ##■質問
32
- 上記目的を達成するための常套の手法などございましたらヒントなどいただけますと誠にありがたく存じます。
32
+ 上記目的を達成するための常套の手法などございましたらヒントなどいただけますと誠にありがたく存じます。
33
+
34
+
35
+ ##■環境
36
+ Windows 10
37
+ Python 3.8.3