본문 바로가기

4일차 python 확장 - C 언어 Python 에서 C Library 사용python 이 32bit 기본설치의 경우 아래의 경로에 python 관련 파일들이 존재함%LocalAppData%\Programs\Python\Python37-32 C 로 작성된 DLL 을 python 에서 활용하기DLL 만들기 Visual Studio Community 설치 (C++ 개발환경)빈프로젝트 생성, 프로젝트 이름을 dll 파일명과 동일하게 하기파일 생성, 파일명도 dll 파일명과 동일하기 하기 솔루션 구성 - Release, 솔루션 플랫폼 - 64bit or 84bit 설정하기프로젝트 > 속성 > C/C++ 탭 > 추가 포함 디렉터리에 아래 경로 포함 %LocalAppData%\Programs\Python\Python37-32\include프로젝트 >.. 더보기
3일차 library librarylibrary 설치방법파이참 > ctrl + alt + s 눌러 셋팅 창 띄움Project > Project interpreter 선택 > + 버튼 선택 > packet 검색 및 설치 Object Serializationpicklepickle.loadpickle.dump DBshelve - DB. dict처럼 사용 엑셀 파일 제어xlsxWriter: 쓰기전용openpyxl: 읽기 쓰기 가능 (library 설치 필요)import openpyxl # overwritewb = openpyxl.Workbook()ws1 = wb.activews1.title = 'sheet1'ws2 = wb.create_sheet('sheet2') ws1['A1'] = 10ws1['B1'] = 20ws1['C1'] .. 더보기
3일차 Class Classclass Test: # 모든 class 는 object 를 상속받고 있음 def __new__(cls): # class method print('new call') return object.__new__(cls) # object class 의 객체생성 def __init__(self): #생성자 print('init call') self.a = 10 self.b = 20 def __del__(self): #소멸자 print('destory') @staticmethod def staticFunc(): # self 가 없으면 static 함수 print('call staticFunc') obj = Test() # 힙영역에 Test 메모리 할당되고 다음 두 과정이 수행됨## 1. obj = Test.. 더보기