Python 66

ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

환경 : windows 10 오류 메세지 C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\shb22\appdata\local\programs\python\python39\include -Ic:\users\shb22\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14. 28.29910\include..

python text compare

#-*- coding: utf-8 -*- 는 당연히 추가한 상태였다. a = "가나" b = "가나" 보통 이런 경우에는 a == b, a in b 등으로 비교가 가능하다 그런데 만약 False를 떨궈준다면?.... import difflib diff = difflib.Differ() result = list(diff.compare(a, b)) 이렇게 한번 돌려본다 나의 경우에는 하나는 자모 분리가 되고 하나는 안되고 있었다 -_-;;; 미쳤나... 가나, ㄱ ㅏ ㄴ ㅏ ............@ㅅ@?!! 해결 방법은 아래와 같다 import unicodedata a = "가가" b = "가가" a_ = unicodedata.normalize('NFC', a) b_ = unicodedata.normaliz..

scraping issue handle

특정 엘리먼트 클릭 driver.find_element_by_id('').click driver.find_element_by_xpath('').click() 반응형 웹에서 특정 엘리먼트를 클릭해서 페이지를 추가 로딩할때 오류가 난다면 el = driver.find_element_by_xpath('') driver.execute_script("arguments[0].click();", el) 화면 로딩하는거 기다릴때 driver.implicitly_wait(시간) pdf로 스크린샷 찍기 driver.execute_script('window.print();') 화면 가장 아래로 스크롤링 driver.execute_script("window.scrollTo(0, document.body.scrollHeight..

Python 2020.12.20

calendar 를 이용해서 년-월-일 목록 뽑아내기

import calendar calendar.calendar(2020) 이렇게 출력하면 -_-;; 스트링으로 된 달력(윈도우에서 보여주는 달력같은 ㅡㅡ) 이 출력됩니다. 이걸 쓰는건 좀 지저분하고 후처리가 복잡해질것 같아서 다른 방법으로 날짜 목록을 출력해보았습니다. import calendar month_range = [] for i range(2019, 2022): #year for j in range(1, 13): #month final_day = calendar.monthrange(i, j) month_dict = dict(year=i, month=j, day=final_day[1]) # 각 달의 마지막 날짜를 체크한다 month_range.append(month_dict) date_list = ..

dictionary

1딕셔너리에서 원하지 않는 값을 안전하게 지워보자 순회문 도중에 pop 남발하기 pop은 정확하게는 지우는 것이 아니라, 지정한 key의 value만(!) 던져주고 딕셔너리에서는 지워버립니다. test_dict_01 = dict() test_dict_01['a'] = 1 test_dict_01['b'] = '' test_dict_01['c'] = None for k, v in test_dict.items(): if v == None: test_dict.pop(k) 위와 같이 순회문 도중에 pop으로 지우면 갑분 에러를 만나게 됩니다. Traceback (most recent call last): File "test.py", line 6, in for k, v in test_dict.items(): Run..