본문 바로가기

분류 전체보기

(99)
[python] 병아리의 파이썬 웹스크래핑 사용법 - request/beautifulsoup 웹스크래핑.... 정말 오랜만이다... 파이썬으로 웹스크래핑은 처음해본다 아자 - ! 기본 사용법 from bs4 import BeautifulSoup # 읽으려는 파일 이름으로 ㄱㄱ with open("website.html", encoding= 'utf-8') as file : contents = file.read() soup = BeautifulSoup(contents, 'html.parser') # 보기 편하게 들여쓰기 # print(soup.prettify()) # 모든 앵커 태크를 불러올 수 있음 all_a = soup.findAll(name = "a") for tag in all_a : # 태그말고 내용만 보기 print(tag.getText()) # 하이퍼링크만 보기 print(tag.ge..
[python] pixela api 사용하여 해빗트래커 기록하기 !! - api/requests/http헤더 사이트 https://pixe.la/ Pixela | Record and Track your habits or effort. All by API.Pixela, Record and Track your habits or effort. All by API. | Pixela is the API service. With this service, you can get a GitHub like graph that expresses the degree of your daily various activities on a basis with a vivid gradation. All operations are perpixe.la http request 란 ? 서버와 클라이언트가 데이터를 주고받기 위한 방식 - get : 데..
[python] 파이썬 환경변수 설정하여 불러오기 - os 코드에 개인정보 넣지말고 환경변수에 저장해서 파이썬의 os 모듈로 불러오기 ! 환경변수를 사용하면 코드 수정을 하지 않고도 변수를 수정할수 있어 유지보수에 좋다고 한다 ㄱㄱㄱ 파이참에서 터미널로 이동한다 환경변수 설정값을 확인하고 싶다면 유닉스 계열env 윈도우Get-ChildItem Env: 로 목록을 확인 가능 환경변수를 설정하고 싶다면 ? 유닉스 계열export [변수명]=[변수값] 윈도우set [변수명]=[변수값] 로 설정한다 파이썬 코드에선 이렇게 불러와 사용 가능 ! import os print(os.envirion.get("[변수명]"))
[python] 파이썬 타입 힌트 파이썬 type hint 라는게 있는데,입력값과 리턴값의 형태를 지정할 수 있도록 힌트를 준단다 # name 은 str , return 은 strdef hi(name : str) -> str : return 'hi' + str
[python/HTML] unescape 언이스케이핑 하는법 html 에서의 encode 된 글자를 unescape 해야 멍청하지 않은 글자를 볼 수 있다. 파이썬에서 언이스케이프 하는 방법은 간단하다. import htmlhtml.unescape("unescape 하고싶은 무언가 ")
[python] 파이썬 칸예 명언 어플리케이션 - API/requests/thinker 왜 칸예 명언을 출력하는 API 가 있는지 모르겠다. https://kanye.rest/ kanye.restA free REST API for random Kanye West quoteskanye.rest 😎 코드from tkinter import *import requestsdef get_quote(): response =requests.get("https://api.kanye.rest") response.raise_for_status() result = response.json()["quote"] canvas.itemconfig(quote_text, text = result)window = Tk()window.title("Kanye Says...")window.config(pa..
[HTTP/응답코드] 코드별 간단 상태 정리 웹사이트를 응답할때 응답코드에 따라 회신상태를 알 수 있다. 예전에 한참 프론트엔드 개발하고 보안 공부할때 많이 봤는데,오랜만에 보니까 새삼 새롭다. 역시 죽을때까지 리뷰하고 공부해야 하나보다 😱 응답코드의 첫번째 번호로 응답결과를 예측할 수 있다. 라는데 코드가 많으니 관련 사이트에서 확인 할 수 있다. 나무위키 매니아니까 이걸로 본다 ... ㅎㅎhttps://namu.wiki/w/HTTP/%EC%9D%91%EB%8B%B5%20%EC%BD%94%EB%93%9C HTTP/응답 코드HTTP 응답 코드를 정리하는 문서. MDN Web Docs 나 2024년 9월 현재 최신 문서인 RFC 91namu.wiki
[python] 파이썬 클라우드에서 실행하는 무료 배치 스케줄러 python anywhere 사용법 https://www.pythonanywhere.com/ Host, run, and code Python in the cloud: PythonAnywhereBatteries included With Python versions 2.7, 3.6, 3.7, 3.8, 3.9 and 3.10, and all the goodies you normally find in a Python installation, PythonAnywhere is also preconfigured with loads of useful libraries, like NumPy, SciPy, Mechanize, BeautifulSoup, pycrwww.pythonanywhere.com파이썬 파일을 클라우드에서 스케줄러를 등록해서 실행하는 방법..

반응형