response = requests.get(URL)
r = response.json()
items = r['body']
SIGUN = [item['SIGUN'] for item in items]
ADRES = [item['ADRES'] for item in items]
TIME = [item['TIME'] for item in items]
MENU = [item['MENU'] for item in items]
MNMNU = [item['MNMNU'] for item in items]
CMPNM = [item['CMPNM'] for item in items]
TELNO = [item['TELNO'] for item in items]
안녕하세요 교수님 2021130907 정혜선입니다.
def test(CMPNM): URL = ('http://apis.data.go.kr/6430000/cbRecreationalFoodInfoService/' 'getRecreationalFoodInfo?' 'serviceKey=KUte%2B1a0lMg33Joa%2Bu5ovcX%2F3e%2F7mY8MYvtinzMjlJUetgUjZdZY%2BElYD6eL9akDvYlj0%2Fn3Na74Cy%2BKubHUzg%3D%3D' '¤tPage=1' '&perPage=10' '&CMPNM='+CMPNM+)
response = requests.get(URL) r = response.json() items = r['body']
SIGUN = [item['SIGUN'] for item in items] ADRES = [item['ADRES'] for item in items] TIME = [item['TIME'] for item in items] MENU = [item['MENU'] for item in items] MNMNU = [item['MNMNU'] for item in items] CMPNM = [item['CMPNM'] for item in items] TELNO = [item['TELNO'] for item in items]
SIGUN = pd.Series(SIGUN) ADRES = pd.Series(ADRES) TIME = pd.Series(TIME) MENU = pd.Series(MENU) MNMNU = pd.Series(MNMNU) CMPNM = pd.Series(CMPNM) TELNO = pd.Series(TELNO)
df = pd.DataFrame({'시군':SIGUN, '주소':ADRES, '운영시간':TIME, '메뉴':MENU, '메인메뉴':MNMNU, '상호':CMPNM,'전화번호':TELNO}) return df
File "" , line 7
'&CMPNM='+CMPNM+)
^
SyntaxError: invalid syntax
이렇게 뜨는데 오류가 나는 이유를 잘 모르겠습니다...