오렌지 보틀에서 일하고 싶다는 꿈을 갖고 있습니다. 각 지점에 전화를 해서 아르바이트 자리가 없는지 물어보려고 하는데요. 오렌지 보틀의 웹사이트에 가서, 모든 지점의 전화번호를 모아봅시다.
모든 지점의 전화번호를 phone_numbers 리스트에 담아주세요.
phone_numbers라는 리스트에 전화번호 정보를 담기위해서는 첫번째로는 정상적으로 전화번호 정보를 가져올 수 있어야 한다.
전화번호의 경우, class='phoneNum' 으로 아예 지정이 되어있었기때문에 쉽게 해당 값을 가져올 수 있었다.
값을 가져올 수 있다면 그냥 리스트에 넣어주면 끝
import requests
from bs4 import BeautifulSoup
### 코드를 작성하세요 ###
url = "https://workey.codeit.kr/orangebottle/index"
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
phone_numbers = []
phone_number_tags = soup.select('.phoneNum')
for tag in phone_number_tags:
phone_numbers.append(tag.get_text())
# 출력 코드
print(phone_numbers)