Python
-
Python예제 - ctypes 기초Python 2019. 3. 5. 21:05
2018/12/10 - Python예제 목록 파이썬용 외부 함수 라이브러리ctypes는 파이썬용 외부 함수(foreign function) 라이브러리입니다. C 호환 데이터형을 제공하며, DLL 또는 공유 라이브러리에 있는 함수를 호출할 수 있습니다. 이 라이브러리들을 순수 파이썬으로 감싸는 데 사용할 수 있습니다.윈도우는 일반적인 .dll 파일 접미사를 자동으로 추가합니다.cdll은 표준 cdecl 호출 규칙windll은 stdcall 호출 규칙oledll은 stdcall 호출 규칙함수가 윈도우 HRESULT 에러 코드를 반환한다고 가정합니다. 에러 코드는 함수 호출이 실패할 때 OSError 예외를 자동으로 발생시키는 데 사용됩니다. 리눅스에서 라이브러리를 로드리눅스에서, 라이브러리를 로드하기 위해서..
-
Python예제 - 콘솔창 타이틀 이름 변경, 얻기Python 2019. 3. 5. 17:26
2018/12/10 - Python예제 목록 변경 방법1from os import systemsystem("title "+"MyTitle") 변경 방법2import ctypesctypes.windll.kernel32.SetConsoleTitleW("MyTitle") 얻기 방법1import ctypesDefBuffer = 256buffer1 = (ctypes.c_char * DefBuffer)()res = ctypes.windll.kernel32.GetConsoleTitleW(buffer1, DefBuffer)pytitle = buffer1.valueprint (pytitle) 얻기 방법2import ctypesDefBuffer = 256buffer1 = ctypes.create_unicode_buffer..
-
Python예제 목록Python 2018. 12. 10. 12:03
Python 예제들 2019/03/05 - Python예제 - ctypes 기초 2019/03/05 - Python예제 - ctypes 데이터형 2019/03/05 - Python예제 - 콘솔창 이름 변경 Python예제 - SMTP Email: http://infos.tistory.com/1815 x Python - 파일 관련: http://infos.tistory.com/1797 x Python 확장기능 MapReduce, Multiprocess: http://infos.tistory.com/1648 x Python예제 - python3 exe파일 만들기: http://infos.tistory.com/1598 x Python함수 - string.format() 서식화 ( 0으로 채우기 등 ): htt..
-
Python예제 - SMTP EmailPython 2018. 10. 6. 21:36
참고Python예제: http://infos.tistory.com/1982 https://docs.python.org/3/library/email.examples.html # -*- coding:utf-8 -*-import smtplibfrom email.mime.text import MIMEText # or email.mime.multipart.MIMEMultipart import MIMEText msg = MIMEText('본문 테스트')msg['Subject'] = '제목 테스트'msg['To'] = 'toid@gmail.com' smtp = smtplib.SMTP('smtp.live.com', 587) # or smtp.gmail.com, 587smtp.ehlo() # Smtp protocal 가..
-
Python예제 - soup 기본 개념Python 2018. 2. 3. 21:11
참고Python예제: http://infos.tistory.com/1982* html 기본 구조: http://infos.tistory.com/1591* CSS 기본 구조: http://infos.tistory.com/1592* CSS태그의 문단 구분: http://infos.tistory.com/1593* 정규식 re : http://infos.tistory.com/1556 * python importfrom bs4 import BeautifulSoup as bs * 생성 ex1html1 = ''html2 = 'text 'soup = bs(html2, 'html.parser') * soup객체 인스턴스는 맴버변수로 태그간 상하 참조 관계를 가진다.class bs # BeautifulSoupparent ..