# https://irongaea.github.io/2018/07/29/bs4-select/
import requests
from bs4 import BeautifulSoup  # BeautifulSoup import

while True:
    yearmon = input("증포중학교 년월: (ex.201904)")
    url = 'http://www.jpo.ms.kr/lunch.list?ym=' + yearmon
    response = requests.get(url)
    html = response.text
    soup = BeautifulSoup(html, 'html.parser')  # html.parser를 사용해서 soup에 넣겠다
    for day in soup.select('div[class="dayBox"]'):
        print(day.select('span')[0].text)
        yy = day.select('div[class="content"] div[class="tabContent on"] a')
        if len(yy) > 0:
            print(yy[0].text.strip())
        print("---------------------")
