일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- c++11
- Unity
- null
- pandas
- boost
- 쉘
- SSH
- with
- ngui
- Shader
- conda
- dataframe
- python
- SVN
- 배열
- FIND
- Eclipse
- sqlite
- autovacuum
- C++
- DROP
- mysql
- ubuntu
- awk
- List
- expect
- pi
- if
- postgresql
- sql
- Today
- Total
목록python (25)
その先にあるもの…
파이썬 버전 3.6.5 open( '파일' )로 읽을 때 UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 6987: illegal multibyte sequence 라는 에러가 발생한다면 open( '파일', 'rt', encoding='UTF8' )로 변경하면 에러가 발생하지 않는다.
버튼이 눌렸을 때 발생하는 일을 하기 위해서는 코드에서 시그널을 주는 객체와 시그널을 받는 슬롯을 연결하는 코드(예제1)를 작성해야 한다. 예제1 : self.btn1.clicked.connect( self.slot1)btn1이 clicked 할 때 함수 slot1을 호출하는 코드이다. Qt Designer에서 시그널/슬롯 편집기 기능을 지원하며 그 기능을 사용하면 아래 코드 처럼 함수만 작성하면 된다. 1234567891011121314151617181920212223242526from PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5 import uic mainwindow_class = uic.loadUiType("MainWindo.ui")[..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162s1 = set([1,2,3])print(s1){1, 2, 3} #중복을 허용하지 않는다.#순서가 없다.s2 = set("Hello")print(s2){'l', 'H', 'o', 'e'} #list, tuple로 변환li = set([1,2,3,4,1])print(li){1, 2, 3, 4} tp = set((1,2,3,4,1))print(tp){1, 2, 3, 4} s1 = set([1,2,3,4,5])s2 = set([4,5,6,7,8]) #교집합print( s1 & s2 )print( s1.int..
12345678910111213#red, black, green 3개의 요소에 가중치를 주고 k만큼 얻는다.choices(['red', 'black', 'green'], [18, 18, 2], k=6)['red', 'green', 'black', 'black', 'red', 'black'] # Deal 20 cards without replacement from a deck of 52 playing cards and determine the proportion of cards with a ten-value# (a ten, jack, queen, or king).# ten 16개, low_card 36개의 리스트 counter객체 생성deck = collections.Counter(tens=16, low_..
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816..
12345678910111213141516171819202122232425262728_files = {}def share_file(filename): if filename not in _files: ret = _files[filename] = open(filename) else: ret = _files[filename] return ret#한 번 _files에 등록된 내용은 삭제되지 않는다. import weakref _files = weakref.WeakValueDictionary()def share_file(filename): if filename not in _files: ret = _files[filename] = open(filename) else: ret = _files[filename] re..