본문 바로가기

Programming/Python55

[python] Qt Designer 화면 디자인 [python] Qt Designer 화면 디자인 Qt Designer 에서 디자인을 만든다음 파일을 저장합니다. 이 예제에서는 untitled.ui로 저장하였습니다.커맨드창에서 python 코드로 변경하는 명령어를 실행합니다. pyuic5 untitled.ui -o untitled.py 생성된 untitled.py 파일을 이용하여 파이썬 코드를 작성합니다. import sys from PyQt5.QtWidgets import * from qt.untitled import Ui_Dialog class XDialog(QDialog, Ui_Dialog): def __init__(self): QDialog.__init__(self) # setupUi() 메서드는 화면에 다이얼로그 보여줌 self.setupUi.. 2017. 3. 18.
[python] python3 에서 URL encode python3 에서 URL encode 한글을 URL에 포함할 경우 URL encoding을 합니다. #!/usr/bin/env python3 from urllib.parse import quote from urllib.request import urlopen url = 'http://wikipedia.org/wiki/' + quote("한글") content = urlopen(url).read() 출처 http://stackoverflow.com/questions/11818362/how-to-deal-with-unicode-string-in-url-in-python3 2017. 3. 17.
[Python] 파이썬 표준라이브러리 파이썬 표준라이브러리 atexit: 프로그램이 종료될 때 호출되는 함수를 등록할 수 있게 해 준다. argparse: 명령행 매개 변수를 파싱하는 기능을 제공한다. bisect: 리스트 정렬을 위한 바이섹션(bisection) 알고리즘을 구현했다. calendar: 날짜 관련 함수들을 제공한다. codecs: 데이터 인/디코딩을 제공한다. collections: 아주 다양한 데이터 구조를 제공한다. copy: 데이터를 복사하는 기능을 제공한다. csv: CSV 파일을 읽고 쓰는 기능을 제공한다. datetime: 날짜와 시간을 다루는 클래스들이 있다. fnmatch: 유닉스 스타일의 파일 이름 패턴을 찾는 함수들을 제공한다. glob: 유닉스 스타일의 경로 패턴 찾기 기능을 제공한다. io: I/O 스트.. 2017. 1. 15.
pycharm, pandas-datareader warning from pandas.io.data import DataReader df = DataReader('005930.KS', 'yahoo', start, end) Pycharm 으로 파이썬 코드를 작성하는 중에 아래와 같은 경고 메시지가 나오면 pandas-datareader 패키지를 설치한다. The pandas.io.data module is moved to a separate package (pandas-datareader) and will be removed from pandas in a future version. After installing the pandas-datareader package (https://github.com/pydata/pandas-datareader), you can cha.. 2017. 1. 7.
jupyter 사용해보기 jupyter 사용해보기 맥에서 할 수없는 프로그램을 맥에서 돌리기 위한 방법을 찾다가 jupyter를 알게 되었습니다. 설치 아나콘다를 설치합니다. CybosPlus 를 이용하기 위한 목적이라면 32bit 윈도우용으로 설치합니다. 실행 아나콘다에 jupyter 패키지가 포함되어 있기 때문에 설치가 끝나면 바로 실행하면 됩니다. jupyter notebook 기본 8888 포트로 서비스가 실행되고 자동으로 웹브라우저로 접속하게 됩니다. 설정 변경 설정 파일 생성 기본으로 실행하게 되면 local에서만 접근할 수 있기 때문에 설정값을 변경합니다. 실행 되어 있는 프로세스를 종료합니다. jupyter notebook --generate-config config 파일을 생성합니다. 위의 명령어를 실행하면 co.. 2016. 12. 19.
python decode error - UnicodeDecodeError: ‘utf-8’ codec can’t decode python decode error - UnicodeDecodeError: ‘utf-8’ codec can’t decode Download file from web in Python 3decode 시에 error 가 발생하면 error 파라미터를 같이 넘긴다. >>> html = html.decode('utf-8') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 38395: invalid start byte The errors argument specifies the response when the input string can’t.. 2016. 6. 22.