일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- boto3
- functools.wraps
- Airflow
- Python
- 순수함수
- PIP
- reverse v.s. reversed
- 쿼리
- blinker
- os.path
- 함수형 프로그래밍
- r-string
- sort v.s. sorted
- [초급(예비) 개발자 오픈소스 실무 역량강화 교육]
- timestamp
- sort(reverse=True) v.s. reverse
- OS
- slicing [::-1]
- 코딩 테스트
- S3
- decorator
- pandas
- 생각
- 고차함수
- selenium-wire
- ds_store
- CI/CD
- Today
- Total
목록분류 전체보기 (119)
공부일지

정렬 문제를 푸는데 푸는 방법을 찾아보던 중 다양한 자료구조를 활용할 수 있는 걸 알게됐다. 목차1. 정렬할 때 쓰는 자료구조(더 있을 수 있음.)2. 쓰고 느낀 장단점(+ GPT 추가 설명)아래 나열한 방식 중 실제로 써본건 namedtuple과 struct이다.참고용으로 다 묶어서 올려본다.# tuple# tuple 그대로 쓰면 됨print("Tuple 방식:")for s in students: print(s)# namedtuplefrom collections import namedtuplestudent = namedtuple('student', ['id', 'math', 'comp'])s = student(1, 90, 80)print(s.id, s.math, s.comp)# structimpo..
'''https://codeup.kr/problem.php?id=10941094 : [기초-1차원배열] 이상한 출석 번호 부르기2input1010 4 2 3 6 6 7 9 8 5output5 8 9 7 6 6 3 2 4 10'''import timestart1 = time.time()n = int(input())nums = input().split()nums.reverse()print(' '.join(nums))end1 = time.time()start2 = time.time()n = int(input())nums = input().split()print(' '.join(list(reversed(nums))))end2 = time.time()notice = f'''time1: {end1 - start1}..

'''https://codeup.kr/problem.php?id=14101410 : 올바른 괄호 1input((())()(()))output6 6'''import timestart1 = time.time()gwalho = list(input())left_cnt = 0right_cnt = 0for i in gwalho: if i == '(': left_cnt += 1 elif i == ')': right_cnt += 1print(left_cnt, right_cnt)end1 = time.time()start2 = time.time()from collections import Countercounter = Counter(gwalho)# print(counter.items()..

파이썬으로 코딩테스트를 준비할 때 입력은별도로 import 필요 없는 내장함수 input()이나 import sys를 통해 stdin.readline()을 이용할 수 있다. 눈으로 보기에는 input() 보다 stdin.readline() 더 길고 import 도 하기 때문에 입력시간이 더 길 것 같다.과연 그럴지 한번 확인해보자.'''https://codeup.kr/problem.php?id=14091409 : 기억력 테스트 1input10 9 8 7 6 5 4 3 2 13'''import sysimport timestart1 = time.time()arr = list(map(int, input().split()))k = int(input())print(arr[k-1])end1 = time.time()..

작성일: 2024-10-08 Selenium Wire Request/Response Objectshttps://scrapeops.io/selenium-web-scraping-playbook/python-selenium-wire/#selenium-wire-requestresponse-objects Selenium Wire - Extending Python Selenium | ScrapeOpsIn this guide, we walk through Selenium Wire a extension for Python Selenium that gives you more control over requests & responses.scrapeops.io 이제 request와 request.response의 객체들..
작성일: 2024-10-08 selenium-wire option 설정하기이제 webdriver의 옵션을 설정하기 위해ChromeOptions의 객체를 만들어준다. (변수 options에 해당)from selenium.webdriver import ChromeOptions()...options = ChromeOptions()options.add_argument('--start-maximized')options.add_argument('--headless')options.add_argument(f'user-agent={useragent}')service = Service(executable_path=executable_path)driver = webdriver.Chrome(service=service,..
작성일: 2024-10-08 selenium-wire 완전히 설치하기pip install selenium-wire # seleniumwire로 쓰면 안 됨 설치는 안전하게 마무리됐지만selenium-wire를 import한 모듈을 실행시키니Error occured.No module named 'blinker._saferef' 아래 답변을 참고해서아래와 같이 blinker 모듈 버전 명시해서 설치했더니 해결됐다.pip install blinker==1.7.0더보기c.f.https://github.com/seleniumbase/SeleniumBase/issues/2782 Wire Mode: `No module named 'blinker._saferef'` if installing `selenium-wi..

작성일: 2024-10-04 서론가끔 pip install이 안 되는 경우가 생긴다.다양한 원인이 있겠지만 내게 자주 발생하는 이유는 아래와 같다. 본론1. (자주 발생) import 됐을 때 이름과 설치할 때 쓰는 이름이 달라서 생긴다. 기존 프로젝트에서 쓰던 모듈을 새로운 프로젝트 환경에 설치하고자 할 때 종종 생기는 문제가 있다. from PIL import Image import yaml from seleniumwire import webdriver 위와 같이 기존 프로젝트 파일에 import할 때와 설치할 때 쓰는 패키지명이 다른 경우에 발생한다.pip install PIL 하면 결과는 다음처럼 에러가 뜬다. -> 해석하자면 해당되는 version도 없고 그런 이름에 맞는 배포된 게 없..
작성일: 2024-10-02 CI/CD 개념"Continuous Integration"과 "Continuous Deployment/Delivery"인터넷에서 찾아보면 자세한 의미가 나온다.내가 이글을 작성하는 이유는 개념에 대한 내 이해도 차이가 생긴 것을 기록하고 싶어서이다. 전에는 '그냥 Continuous 어쩌구이고 지속적으로 서비스를 테스트 - 빌드 - 배포 하는 방법이다.' 정도로 인식했다.진짜 그 의미를 이해했다기 보다는 '대충 이런 개념이구나'. 정도로 말이다. 그런데 뭐 한다고 부딪혀보니까 이제는 감이 왔다.로컬에서 소스코드 작성 후 깃 커밋 & 푸시를 해준다.이렇게 관리된 프로젝트를 24시간 돌아가는 원격 서버(가령, AWS EC2)에 SSH 터널링을 통해 접속한 뒤에git clone해..

작성일: 2024-09-30 상황이미지 데이터를 관리하는 컨테이너로 S3를 쓰고 있다.Python에서는 AWS S3 API로 boto3가 있어서 이를 이용한다.그런데 boto3를 이용한 이미지 데이터 업로드 코드를 작성하던 중에버킷의 개념이 헷갈려서 좀 찾아보았다. 헷갈렸던 부분1. S3 버킷은 파일 시스템의 폴더(디렉토리)와 같은 개념인가?2. 버킷 하위에 생성되는 저장구조는 버킷인가 아니면 다른 무엇인가? 빠른 결론1. 아니다. 2. 버킷 하위에 생성되는 저장구조는 따로 없고, 버킷 내에 저장되는 데이터는 모두 '객체(Object)'라고 한다. 자세히AWS S3에서 "폴더"의 개념은 일반적인 파일 시스템과는 다르다.사실 S3에는 폴더나 디렉터리가 존재하지 않으며, 모든 것은 객체(obje..