본문 바로가기

개발/Python3

[codility] MaxCounters app.codility.com/programmers/lessons/4-counting_elements/max_counters/ MaxCounters coding task - Learn to Code - Codility Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum. app.codility.com 문제에 나온대로 N+1이 됐을 때 마다 n_arr를 새로 만들어줬더니 시간초과 하나가 뜨면서 92퍼 나왔다 최악의 경우 모두 N+1이라면 O(N*M)이라 그런듯 def solution(N, A): # wr.. 2021. 2. 17.
python requests로 웹 페이지 크롤링 하기 웹 페이지의 html 문서를 가져오는 건 쉽다 python 라이브러리인 requests를 사용하면 f12를 누르면 나오는 elements 탭의 내용을 긁어올 수 있다 requests 공식 docs Requests: HTTP for Humans™ — Requests 2.25.0 documentation Requests: HTTP for Humans™ Release v2.25.0. (Installation) Requests is an elegant and simple HTTP library for Python, built for human beings. Behold, the power of Requests: >>> r = requests.get('https://api.github.com/user', auth.. 2020. 12. 11.
selenium으로 웹 정보를 스크랩해보자 셀레니움으로 하고 싶은 것 - node 선택 : x1 ~ x20 - jenkins node들의 빌드 기록 페이지로 접근(/build/computer/x1/builds) - table id="projectStatus", a tag class="model-link inside"의 href 가져오기 - href 클릭 PC 정보 - windows 10 - python 3.8.5 - pip 20.2.2 0. 환경 설정 - python3 설치 : 공식홈 다운로드 - pip 설치 get-pip.py 다운로드 python 설치된 폴더\Script로 가서 pip freeze pip upgrade(필요하면) > pyhton get-pip.py > cd C:\Python\Python38-32\Scripts > pip fre.. 2020. 8. 31.