Python

    Django (Migrate / URLConf / View / Template / QuerySet / Bootstrap)

    1. admin.ModelAdmin -> list_display 사용하여 admin 게시판 리스트 양식 바꾸기 https://www.kite.com/python/docs/django.contrib.admin.ModelAdmin.list_display Kite - AI Coding Assistant for Python and JavaScript Code faster with Kite’s AI-powered autocomplete plugin for Python and JavaScript developers, featuring Multi-Line Completions. Works 100% locally. www.kite.com 1) 관리자 페이지에서 blog앱에 보이는 게시판 양식을 변경해보자 - 기존: t..

    Django설치 및 설정 & 간단한 게시판 만들기

    1. 세팅 - 파이썬 깔린 곳 위치 확인 - 파이썬 깔린 위치 확인 후, 다음과 같이 환경변수 추가 - PyCharm Terminal창에서 파이썬 version & Anaconda내장 파이썬 아닌 찐 파이썬 그 자체로 설정되있는지 확인 - PyCharm Terminal창에서 django 설치 - django 버전 확인 - django 설치 확인 2. Django 프로젝트 생성 - 자신이 원하는 폴더 아래 django_src라는 하위 폴더 생성 - Django 프로젝트 생성 명령어 - django_src폴더 안에 manage.py 파일과 자신이 지정한 이름의 폴더가 생성된 것을 볼 수 있다. - 폴더 안에는 다음과 같은 구성으로 돼있다. - manage.py : 웹사이트 관리를 도와주는 역할을 하는 파일 ..

    Python - cine21 데이터 크롤링

    1. 씨네 21에 있는 배우 정보를 크롤링 해보자 1. 씨네21 홈페이지에 접속 http://www.cine21.com/rank/person 씨네21 대한민국 최고 영화전문매체 www.cine21.com - 1개월치 데이터를 가져올 예정 (이름, 흥행지수, 순위, 출연자, 직업, 성별, 신장/체중, 취미 등등...) 2. 개발자도구 -> content클릭 -> Request URL에 있는 URL이 진짜 URL임. request로 가져올 때 저 URL사용해야함 3. Post방식으로 전달하기 때문에 전달하는 Form Data값 확인(개발자도구 -> content클릭 -> 아래로 내리면 있음) 4. HTML돔 확인한 후 배우의 이름과 각 페이지 URL들을 가져오자!! site 주소 : http://www.ci..

    Selenium

    1. Selenium이란? https://selenium-python.readthedocs.io/ Selenium with Python — Selenium Python Bindings 2 documentation Note This is not an official documentation. If you would like to contribute to this documentation, you can fork this project in Github and send pull requests. You can also send your feedback to my email: baiju.m.mail AT gmail DOT com. So far 40+ community selenium-python.readthe..

    파이썬 OpenAPI_07월 24일

    1. Melon 100 Chart 스크래핑 100곡 노래의 title, id 추출 Song의 Detial 페이지로 100번 요청해서 상세정보 추출 Pandas의 DataFrame에 저장 DB에 Song Table로 저장 - 100곡 노래의 title, id 추출 * 멜론의 경우 user_agent가 필요!! - 멜론에서 그렇게 걸어놈 ㅇㅅㅇ - 로봇이 아님을 증명하기 위해 사용 import requests from bs4 import BeautifulSoup import re url = 'https://www.melon.com/chart/index.htm' request_header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWe..

    파이썬 OpenAPI_07월 23일

    Pandas 1. iloc[] 사용(원하는 index줘서 선택) ** data/data_draw_korea.csv사용 data = pd.read_csv('data/data_draw_korea.csv') - iloc[] : column index, row index 줌 # iloc[]사용 data.iloc[0:3,0:3] - iloc 또한 2개 간격으로 출력 가능~!! data.iloc[0:20:2,0:3] - unique() : 중복제거 : 광역시도 중복제거하기 # 광역시도 이름 확인(중복된 이름 빼고) print(data['광역시도'].unique()) - unique() : 중복제거 : 행정구역 중복제거하기 print(data['행정구역'].unique()) - sample(원하는 갯수) : 원하는 ..

    파이썬 OpenAPI_07월 22일

    1. 웹 설명 1. html(Hyper Text Markup Language) 2. DOM(Document Object Model) - dom tree - traversing, traverse(순회) - manipulation(조작) : tree변경 3. 특정 문자열 가져오기 - 방법1 : 정규표현식 - 방법2 : HTML Parser라이브러리 (ex)BeautifulSoup4, lxml ​ 2. 웹툰 회차별 이미지 다운로드 - 제목, 회차, url을 입력받는 함수 정의 #title(제목), 회차, url 을 입력 받아서 저장하는 함수 정의 import os import requests from bs4 import BeautifulSoup def write_image(title,seq, url): #ur..

    파이썬 OpenAPI_07월 21일

    참고 문서 https://realpython.com/python-requests/ Python’s Requests Library (Guide) – Real Python In this tutorial on Python's "requests" library, you'll see some of the most useful features that requests has to offer as well as how to customize and optimize those features. You'll learn how to use requests efficiently and stop requests to external serv realpython.com - 웹툰 이미지 크롤링 1. 네이버 웹툰 이미지 다운로드 ..