본문 바로가기
반응형
tkinter 메뉴바 import tkinter window=tkinter.Tk() def close(): window.quit() window.destroy() def menu_bar(): menubar=tkinter.Menu(window) menu_1=tkinter.Menu(menubar, tearoff=0) menu_1.add_command(label="하위 메뉴 1-1") menu_1.add_command(label="하위 메뉴 1-2") menu_1.add_separator() menu_1.add_command(label="하위 메뉴 1-3", command=close) menubar.add_cascade(label="상위 메뉴 1", menu=menu_1) menu_2=tkinter.Menu(menubar, tea.. 2022. 8. 1.
tkinter 버튼 그리기 import tkinter tk = tkinter window=tkinter.Tk() def show_button(): button_select = tk.Button(window, text="선택") button_next = tk.Button(window, text="다음") button_pre = tk.Button(window, text="이전") button_select.pack(side="left") button_next.pack(side="left") button_pre.pack(side="left") show_button() window.mainloop() 2022. 8. 1.
python (json 파일 읽기) import json import os path = os.path.join('경로') path_list = os.listdir(path) for i in path_list: file_path = path+'/'+i with open(file_path, "r", encoding='utf-8') as json_file: json_data = json.load(json_file) 2022. 4. 24.
array to json (TypeError: Object of type ndarray is not JSON serializable) class NumpyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.ndarray): return obj.tolist() return json.JSONEncoder.default(self, obj) a = np.array([[1, 2, 3], [4, 5, 6]]) print(a.shape) json_dump = json.dumps({'a': a, 'aa': [2, (2, 3, 4), a], 'bb': [2]}, cls=NumpyEncoder) print(json_dump) 출처 : https://stackoverflow.com/questions/26646362/numpy-array-is-not-json-serializable 2022. 4. 24.
opencv imread error (경로 한글, 영어 섞여있음) import cv2 import numpy as np def isKorean(text): hangul = re.compile('[\u3131-\u3163\uac00-\ud7a3]+') result = hangul.findall(text) if len(result) > 0: return True else: return False if isKorean(file_path) == True: img = cv2.imread(file_path, cv2.IMREAD_COLOR) img = np.fromfile(file_path, np.uint8) img = cv2.imdecode(img, cv2.IMREAD_COLOR) elif isKorean(file_path) == False: img = cv2.imread(fil.. 2022. 4. 14.
opencv error - AttributeError: module 'cv2' has no attribute 'destroyAllwindows' 에러 발생... cv2에 destoryAllwindow()가 없어? # cv2.imshow('img',img) # cv.waitKey(0) # cv.destroyAllwindows("gray") cv2.imshow('img',img) # # Exit if ESC pressed k = cv2.waitKey(0) cv2.destroyAllWindows()​ waitkey(0) 를 변수로 주니깐 성공했어...왜인지 모르겠어...먼 차이지...잘 모르겟당 이미지는 진짜 싫다 2022. 4. 8.
OpenCV error error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' 에러발생 img 읽을 파일이 없음... 이미지 show하기 전 read를 잘했는지 imread()로 잘 읽었는지 확인해보자 2022. 4. 8.
한국어 자연어 데이터 목록 유사도 판별 이름 설명 링크 KorNLI 두 문장의 관계를 entailment/neutral/contradiction 으로 분류 github 학습/ 검증/ 테스트 데이터로 분리되어 있음. KoSTS 두 문장의 유사도 점수를 라벨링한 데이터 github 학습/ 검증/ 테스트 데이터로 분리되어 있음. Question pair 두 개의 질문이 같은 질문인지 아닌지 레이블링한 데이터 github 학습 6,888건 / 테스트 688건 제공 ParaKQC 10개의 비슷한 문장에 대한 1,000개의 집합으로 구성 github 문장 유사도 데이터 494,500건 생성 가능 패러프래이징 데이터 45,000건 생성 가능 PAWS-X 유사문장탐지(Paraphrase detection) (ko, fr, es, de, zh, .. 2022. 4. 7.
소수 찾기 # 소수 갯수 찾기 def primenumber(a): for i in range(2, a): if a % i == 0: return False return True a = int(input()) count = 0 for i in range(a): if i+1 == 2: continue if primenumber(i+1) == True: # print(i+1) count +=1 print(count) 2022. 3. 20.
트위터 크롤링 보호되어 있는 글 입니다. 2022. 2. 10.
반응형