tobby48 5 years ago
parent
commit
c96aee2d8a
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      src/main/python/kr/co/swh/lecture/opensource/html/schoolFood.py

+ 3
- 1
src/main/python/kr/co/swh/lecture/opensource/html/schoolFood.py View File

@@ -10,5 +10,7 @@ while True:
10 10
     soup = BeautifulSoup(html, 'html.parser')  # html.parser를 사용해서 soup에 넣겠다
11 11
     for day in soup.select('div[class="dayBox"]'):
12 12
         print(day.select('span')[0].text)
13
-        print(day.select('div[class="content"] div[class="tabContent on"] a')[0].text.strip())
13
+        yy = day.select('div[class="content"] div[class="tabContent on"] a')
14
+        if len(yy) > 0:
15
+            print(yy[0].text.strip())
14 16
         print("---------------------")