回答編集履歴
1
コードの訂正
answer
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
def isIncludedText(patterns,html):
|
40
40
|
''' patternsで指定された文字列が、引数で渡されたhtmlのテキスト要素中に存在するかチェック '''
|
41
41
|
# html中のテキスト要素を取得(改行も除く)
|
42
|
+
dom = lxml.html.fromstring(html)
|
42
43
|
texts = dom.xpath('//table')[0].text_content().strip().replace("\n","")
|
43
44
|
|
44
45
|
for pattern in patterns:
|
@@ -48,4 +49,6 @@
|
|
48
49
|
|
49
50
|
# A or B or C のいずれかの文字列が入っていればTrue,でなければFalseを表示
|
50
51
|
print(isIncludedText(["A","B","C"],html))
|
51
|
-
```
|
52
|
+
```
|
53
|
+
|
54
|
+
|