본문 바로가기
반응형

IT/Python11

Python PyQt5 QAxContainer import 에러 - anaconda / pyCharm 환경 import sys from PyQt5.QtWidgets import * from PyQt5.QAxContainer import * - QAxContainer import 에서 에러가 난다. https://stackoverflow.com/questions/56451682/pyqt5-and-anaconda-modulenotfounderror-no-module-named-pyqt5 PyQt5 and Anaconda: ModuleNotFoundError: No module named 'PyQt5' I made a totally new, blank environment in anaconda and activated it. I then did "conda install .. 2020. 5. 18.
Python / GUI - GUI(Graphical User Interface) - TUI(Text-based User Interface) : 지금까지 파이썬을 통해 만든 프로그램 기반 Python 의 GUI 프로그래밍은 wxPython, PyQt, TkInter 등과 같은 패키지를 사용한다. TkInter 는 파이썬의 공식적인 GUI 패키지로서 별도의 프로그램을 설치하지 않고도 바로 사용할 수 있다. TkInter 는 복잡한 프로그램을 개발하기는 부족한 면이 있어, wxPython, PyQt 를 많이 사용한다. http://www.wxpython.org/ Welcome to wxPython! All about wxPython, the cross-platform GUI toolkit for the Python language .. 2020. 5. 14.
Python / COM COM ( Component Object Model ) - 마이크로소프트에서 개발한 기술 - explorer open # explorer open explore = win32com.client.Dispatch("InternetExplorer.Application") explore.Visible = True - word open # word open word = win32com.client.Dispatch("Word.Application") word.Visible = True - excel open write # excel open write excel = win32com.client.Dispatch("Excel.Application") excel.Visible = True wb = excel.Workbo.. 2020. 5. 13.
7. Python IDE 1. Python IDE ( Integrated Development Environment ) - 파이썬 통합개발환경 - 비주얼 스튜디오 기반 PTVS ( Python Tools for Visual Studio ) / 이클립스 기반 PyDev / JetBrains의 PyCharm - 비주얼 스튜디오 기반 PTVS ( Python Tools for Visual Studio ) https://github.com/microsoft/PTVS microsoft/PTVS Python Tools for Visual Studio. Contribute to microsoft/PTVS development by creating an account on GitHub. github.com - 이클립스 기반 PyDev http.. 2020. 2. 7.
6. Python 파일읽기 / 쓰기 1. 파일읽기 - 메모장을 열어서 아무 내용을 작성하고, 저장한다. - 디렉토리 구분자는 '\\' OR '/' 을 사용 ( C:/Users/User/Desktop/test.txt ) # 읽기모드 'r' # 텍스트 파일 't' f = open("C:/Users/User/Desktop/test.txt", "rt") # 각 라인을 리스트에 넣은 후 리스트를 반환 lines = f.readlines() lines # 줄바꿈 \n 제거 for line in lines : print( line, end="") # OR for line in lines : print( line.split("\n")[0] ) 2. 파일쓰기 - 빈문서 파일을 만든다 / 문서를 기록한다 / 문서 파일을 닫는다 # 빈문서 파일을 만든다. #.. 2020. 2. 5.
5. Python 클래스 1. 클래스 - class - 클래스 내부에 정의된 함수인 메서드의 첫번째 인자는 반드시 self 이어야 한다. ( 그냥 외울 것 ) # class 선언 class Test : def set_test(self, name, msg) : self.name = name self.msg = msg def print_test(self) : print("------------------------") print("name : ", self.name) print("msg : ", self.msg) print("------------------------") # 인스턴스 생성 test01 = Test() test01 type(test01) test01.set_test("홍길동", "안녕하세요") test01.name .. 2020. 2. 4.
4. Python 함수와 모듈 1. 함수 - def 키워드 / 함수 정의 def print_name( n , str ) : for i in range(n) : print( str ) print_name( 1 , "hello world~!" ) - return / 반환 / 두개의 값 반환은 튜플을 사용 def plus( x , y ) : return x + y plus( 1 , 5 ) print(plus( 1 , 5 )) def plus_minus( x , y ) : p = x + y m = x - y return ( p , m ) plus_minus( 1 , 3 ) print(plus_minus( 1 , 3 )) print(plus_minus( 1 , 3 )[0]) print(plus_minus( 1 , 3 )[1]) ( p , m .. 2020. 2. 4.
3. Python 제어문 1. Boolean - True / False 파이썬의 예약어로 첫 글자를 대문자로 사용한다. a = True type(a) - 파이썬 비교 연산자 연산자 연산자 의미 == 같다. != 다르다. > 크다. = 크거나 같다. 0 : print( "cnt 가 0 보다 크면" ) elif cnt < 0 : print( "cnt 가 0 보다 작으면" ) else : print( "그렇지 않으면 0 이랑 같다." ) 4. for 문 ( 반복문 ) for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(i) - range - 범위 range(0, 11) list(range(0, 11)) for i in range(0, 11) : print(i) - for 와 튜플 - 튜플은 수정할.. 2020. 1. 29.
2. Python 기본자료구조(리스트/튜플/딕셔너리) - 기본자료구조 - 리스트 / 튜플 / 딕셔너리 - list / tuple / dictionary 1. 리스트 ( list ) list01 = [ '아이템01' , '아이템02' , '아이템03', '아이템04', '아이템05' ] - 리스트 인덱싱 list01[0] list01[1] list01[2] list01[-1] list01[-2] list01[-3] - 리스트 슬라이싱 list01[0:2] list01[2:4] list01[:-3] - 리스트 데이터 삽입 list01.append('아이템06') list01.insert( 2 , '중간아이템01' ) - 리스트 데이터 삭제 len(list01) list01[2] del list01[2] 2. 튜플 ( tuple ) t = ('아이템01', '아.. 2020. 1. 20.
반응형