728x90
개발일지3
-
3. <3주차 학습기록>항해99 2022. 12. 2. 22:18
3주차강의에서는 파이썬과 몽고db를 이용해봤다. 파이썬은 괄호를 많이 사용하지 않아 덜 헷갈린다. 사이트의 정보를 파이썬으로 베껴오는 크롤링을 해보았다. 내가 원하는 값만 추출할 수도 있고 보기 쉽게 나열할 수도 있다. .text.strip() 을 붙이면 불필요한 내용과 공백 없이 깔끔하게 값을 추출할 수 있다. 앞으로도 유용하게 쓰일 것 같다! #저장 doc={'name' : 'angela', 'age' : 26} db.users.insert_one(doc) ------>데이터를 저장할 땐 딕셔너리를 하나 만들어 그대로 insert_one 해서 넣어줌 #한 개 찾기 user = db.users.find_one({'name':'angela'}) ------->find_oned을 이용해 해당 부분만 추출할..