
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
일단첫번째 사진은 False를 넣고 실행을 했는데 앞에 오브젝트 id가 안없어 집니다..
두번째 사진은 star끝에 .text를 넣고 실행을 했는데 앞에 나오는 것들이 하나도 안없어지고 뒤에 원하는 답이 나옵니다.. 그냥 print(star.text)하면 잘 나오는데 저렇게 해놓으니 앞에랑 같이 나오네요.. 어떻게 해결 해야되나요?.


첫번째 코드
from pymongo import MongoClient
client = MongoClient('mongodb+srv://test:sparta@cluster0.idr3zpp.mongodb.net/Cluster0?retryWrites=true&w=majority')
db = client.dbsparta
all_users = list(db.users.find({},{'id':False}))
for user in all_users:
print(user)
두번째 코드
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://movie.naver.com/movie/sdb/rank/rmovie.naver?sel=pnt&date=20210829',headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
movies = soup.select('#old_content > table > tbody > tr')
for movie in movies:
a = movie.select_one('td.title > div > a')
if a is not None:
title = a.text
rank = movie.select_one('td:nth-child(1) > img')
star = movie.select_one('td.point').text
print(rank, title, star)
