Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 문자열
- StringBuilder
- QUBIT
- 어노테이션
- 양자
- java
- 아스키코드
- 양자컴퓨팅
- 항해
- bit
- 이행시
- wasm
- CS
- StringBuffer
- Controller
- quantum computing
- 삼행시
- WebAssembly
- 퀀텀컴퓨팅
- Service
- repository
- 윤동주
- yeouido
- Quantum
- 퀀텀
- lombok
- replace()
- 최신기술
- Spring
- 백엔드
Archives
- Today
- Total
건도록 GDlog
항해99 week3 본문
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get('https://www.genie.co.kr/chart/top200?ditc=M&rtm=N&ymd=20210701',headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
#body-content > div.newest-list > div > table > tbody > tr:nth-child(1) > td.number
#body-content > div.newest-list > div > table > tbody > tr:nth-child(2) > td.number
#body-content > div.newest-list > div > table > tbody > tr:nth-child(1) > td.info > a.title.ellipsis
#body-content > div.newest-list > div > table > tbody > tr:nth-child(1) > td.info > a.artist.ellipsis
music = soup.select('#body-content > div.newest-list > div > table > tbody > tr')
for i in music:
rank = i.select_one('td.number').text[0:2].strip()
title = i.select_one('td.info > a.title.ellipsis').text.strip()
artist = i.select_one('td.info > a.artist.ellipsis').text
print(rank, title, artist)
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://test:sparta@cluster0.6hcta.mongodb.net/Cluster0?retryWrites=true&w=majority', tlsCAFile=ca)
db = client.dbsparta
# 저장 - 예시
doc = {'name':'bobby','age':21}
db.users.insert_one(doc)
# 한 개 찾기 - 예시
user = db.users.find_one({'name':'bobby'})
# 여러개 찾기 - 예시 ( _id 값은 제외하고 출력)
all_users = list(db.users.find({},{'_id':False}))
# 바꾸기 - 예시
db.users.update_one({'name':'bobby'},{'$set':{'age':19}})
# 지우기 - 예시
db.users.delete_one({'name':'bobby'})
'개발 > 강의' 카테고리의 다른 글
스파르타 웹개발 종합반 Notion 링크 (0) | 2022.03.23 |
---|---|
항해99 week 2 (0) | 2022.03.01 |
항해99 week1 (0) | 2022.03.01 |