質問編集履歴

9

追記

2019/11/27 03:06

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -141,3 +141,11 @@
141
141
  python 3.8
142
142
 
143
143
  MySQL は 5.7.2 (AWS 上の RDS デフォルト設定)
144
+
145
+
146
+
147
+ ### 追記
148
+
149
+
150
+
151
+ MAC 上で同じコードを動かしたところ問題なく動作しました

8

タグ

2019/11/27 03:05

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
File without changes

7

誤字

2019/11/25 02:27

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  res.encoding = res.apparent_encoding
38
38
 
39
- print(res.text) # この時点ですでに文字化け
39
+ # print(res.text) # この時点ですでに文字化け
40
40
 
41
41
 
42
42
 

6

書式の改善

2019/11/24 17:47

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -98,7 +98,7 @@
98
98
 
99
99
  print(text == text2) # 一致してほしい
100
100
 
101
- ```
101
+ ```
102
102
 
103
103
 
104
104
 

5

書式の改善

2019/11/24 17:12

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -35,6 +35,8 @@
35
35
  print(res.apparent_encoding) # utf-8
36
36
 
37
37
  res.encoding = res.apparent_encoding
38
+
39
+ print(res.text) # この時点ですでに文字化け
38
40
 
39
41
 
40
42
 

4

書式の改善

2019/11/24 16:57

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -36,11 +36,15 @@
36
36
 
37
37
  res.encoding = res.apparent_encoding
38
38
 
39
+
40
+
39
41
  soup = BeautifulSoup(res.content, "lxml")
40
42
 
41
43
  print(soup.original_encoding) # utf-8
42
44
 
45
+
46
+
43
- text = soup.select_one('title').get_text()
47
+ text = soup.select_one('title').get_text()
44
48
 
45
49
  print(text) # yahoo ニュースとなってほしいのにすでに文字化けする
46
50
 
@@ -92,7 +96,7 @@
92
96
 
93
97
  print(text == text2) # 一致してほしい
94
98
 
95
- ```
99
+ ```
96
100
 
97
101
 
98
102
 

3

追記

2019/11/24 16:36

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -134,4 +134,4 @@
134
134
 
135
135
  python 3.8
136
136
 
137
- MySQL は AWS 上の RDS デフォルト設定
137
+ MySQL は 5.7.2 (AWS 上の RDS デフォルト設定)

2

追記

2019/11/24 16:30

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -133,3 +133,5 @@
133
133
  windows 7 上の MSYS ターミナル
134
134
 
135
135
  python 3.8
136
+
137
+ MySQL は AWS 上の RDS デフォルト設定

1

追記

2019/11/24 16:29

投稿

mypt
mypt

スコア170

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  db = settings.db_name,
60
60
 
61
- charset = settings.db_charset
61
+ charset = settings.db_charset # utf-8
62
62
 
63
63
  )
64
64