[AI](47)
-
Environment & Database (6) - Cloud Database / MongoDB
New Stuff Key Points Cloud Database MongoDB Learned Stuff [Cloud Database] Cloud 플랫폼을 구축하고 원격으로 관리하는 Database MongoDB Document 형태의 Database MongoDB Atlas Cloud Database 서비스 중 하나로 인터넷을 통해 어디서든 접속 가능한 서비스 MongoDB 활용법 1. MongoDB 로그인하기 2. Create Organization 3. Create Project 4. Create Cluster Cluster 하나만 무료버전 / 나머지는 비용 발생 5. 생성된 Cluster 확인하기 Pymongo 활용법 NoSQL 형태인 MongoDB 를 다루기 위한 Python 라이브러리 사전 작업..
2021.05.16 -
Python (1) - Python Basic Data Structure
New Stuff Key Points Data Structure List Tuple Dictionary Learned Stuff [Data Structure] 데이터 값의 모임 및 데이터 간의 관계를 의미합니다. 1. List 가장 많이 쓰이는 자료형 동적으로 값 수정 및 정렬이 쉬움 Methods 1. append() - 데이터 맨 뒤에 추가하기 Example # 빈 리스트 생성 empty_list = [] # 리스트에 데이터 추가하기 empty_list.append(1) 2. insert() - 특정 위치에 데이터 추가하기 Example new_list = [1, 2, 3] # 두번째 자리에 5 추가하기 new_list.insert(1,5) new_list # --> [1, 5, 2, 3] 3. de..
2021.05.16 -
Python (2) - Function & Class
New Stuff Key Points Function Class Learned Stuff [Function] 반복적인 코딩을 수행할 때 함수로 설정하면 수월함 Example def add_minus_and_multiply(a,b) : return (a+b) * (a-b) # Ex) print(add_minus_and_multiply(5,10) # returns -75 [Class] 객체를 생성할 때 쓰임 Visualization Explanation Instance - Class 로 정의된 객체를 설정한 init method 에 맞게 호출하는 것 Method - Class 내부에 설정한 함수 Example class Person : def __init__(self,name,age) : self.name ..
2021.05.16 -
Web Scraping + Example (뉴스 기사 제목 스크래핑)
New Stuff Key Points Web Scraping Learned Stuff [Web Scraping] 웹 사이트에서 필요한 부분만 추출하는 작업 Example 뉴스 기사 제목 스크래핑하기 Steps 네이버 뉴스에 들어간 후 '인공 지능' 입력 (다른 키워드 입력 가능) 'F12' 누른 뒤 뉴스 기사 제목에 해당하는 부분의 Class 명 찾기 지금 같은 경우 'a' 라는 class 안에 'news_tit' 라는 sub-class 안에 있음 아래와 같은 코드로 스크래핑하기 import requests from bs4 import BeautifulSoup base_url = 'https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC..
2021.05.16 -
Flask Tutorial(1) - Creating Website
Flask Python 으로 작성된 Web Framework 중 하나 Creating Website 아래와 같은 코드를 입력하면 간단한 Web Application 을 생성할 수 있습니다. 새로운 가상 환경을 만든 뒤 conda install flask 을 통해 flask 패키지 다운 titanic.py 가 있는 폴더에 들어간 뒤 python titanic.py 을 치시면 Web Application 확인 가능 이번 페이지에서는 간단한 어플리케이션을 만들고 제대로 작동하는지만 확인 Debugging Mode python 파일에서 수정을 하고 저장을 하면 웹 페이지에서도 수정본이 출력 (이 때 웹 페이지 새로고침 할 것!) 아래와 같은 git bash 명령어를 입력하면 Debugging Mode 실행됨 C..
2021.05.16 -
Flask Tutorial(2) - Render_Template
Render_Template render_template 메소드를 활용해서 html 파일을 불러올 수 있음 보통 html 파일들은 templates 폴더에서 관리 List 또는 Dictionary 자료구조도 보낼 수 있음 Example Folder Layout TITANIC_FLASK ├── titanic.py ├── templates │ └── base.html titanic.py # filename : titanic.py from flask import Flask,render_template app = Flask(__name__) # Flask 의 instance 만들기 @app.route("/") def first_page() : x = [1,2,3,4,5] y = {"Name" : "Bob", "..
2021.05.16