파이썬 append()와 extend() 차이 append() 함수1. 인수의 자료형에 상관없이 리스트 뒤에 그대로 추가 >>> l = [1, 2]>>> l.append([3, 4])>>> l[1, 2, [3, 4]] extend() 함수1. 인수가 반복 자료형일 경우, 반복 자료형 내부의 각 원소를 추가 >>> l = [1, 2]>>> l.extend([3, 4])>>> l[1, 2, 3, 4] 개발/Python 2021.04.16
파이썬 sort()와 sorted() 차이 sort() 함수1. 리스트만 가능2. 리스트를 직접 정렬하고 None 리턴 >>> l = [3, 1, 5, 2, 4]>>> l.sort()>>> l[1, 2, 3, 4, 5] sorted() 함수1. 리스트, 문자열, 튜플, 딕셔너리 등 반복 가능한 자료형 모두 가능2. 기존 리스트를 복사해서 새로 만들어 반환 -> sort() 함수보다는 다소 느림3. 기존 리스트에는 영향을 주지 않는다. >>> l = [3, 1, 5, 2, 4]>>> sorted(l)[1, 2, 3, 4, 5]>>> l[3, 1, 5, 2, 4] 개발/Python 2021.04.16
비트코인 15분 전 KRW 시세 파이썬 코드 1. PIP blockchain 패키지 설치 $ pip install blockchain 2. 파이썬 코드 작성 후 저장(파일명 : bitcoin.py) 또는 IDLE에서 코드 작성 후 실행(이 경우 3번 실행 안해도 됨.) ---------------------------------------------------------------------------- from blockchain import exchangerates tk = exchangerates.get_ticker() print('1 bitcoin =', tk['KRW'].p15min, 'KRW') ---------------------------------------------------------------------------- 3. .. 개발/Python 2021.04.16
PIP 패키지 설치 $ pip install (패키지명)예) $ pip install numpy 패키지 버전 지정 설치$ pip install (패키지명)=(버전)예) $ pip install numpy=1.19.5 프록시 서버 환경에서 설치$ pip install (패키지명) --proxy (프록시서버 주소)예) $ pip install numpy --proxy http://192.168.0.1:8080 PIP 설치 시 SSL 인증 오류 발생하는 경우$ pip install --trusted-host (host 주소) --trusted-host (host 주소) (패키지명) --proxy (프록시서버 주소)예) $ pip install --trusted-host pypi.org --trusted-host files... 개발/Python 2021.04.16
Ubuntu Python IDLE Install Python 3:$ sudo apt install idle3 Python 2:$ sudo apt install idle-python2.7 Execute IDLE$ idle or (background running) $ idle & 개발/Python 2021.04.15
Python library list backup reinstall 1. python library list backup$ pip freeze > requirement.txt 2. python library reinstall$ pip install -r requirement.txt 개발/Python 2021.04.15
Windows 10 Python 64bit, 32bit install 1. Python 64bit installation(Check [V] Add Python 3.9 to PATH option) * Python 64bint version : 3.9.4(ex, C:\Dev\Python\Python39) 2. Python 32bit installation(Uncheck [ ] Add Python 3.9 to PATH option) * Python 32bit version : 3.9.2(ex, C:\Dev\Python\python39-32) 3. Python version checkC:\Dev> python --version (or python -V)Python 3.9.4 3. Create virtual environment directoryC:\Dev.. 개발/Python 2021.04.15
matplotlib 한글 깨짐 처리 matplotlib 실행 시 한글 깨짐 오류 메시지---------------------------------------------------------------------------------------------------------------------------------findfont: Font family ['san-serif'] not found. Falling back to DejaVu Sans./home/user/.local/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:240: RuntimeWarning: Glyph 51064 missing from current font.font.set_text(s, 0.0, flag.. 개발/Python 2021.04.08
A Byte of Python 한글판 PDFhttp://byteofpython-korean.sourceforge.net/byte_of_python.pdf HTMLhttp://byteofpython-korean.sourceforge.net/byte_of_python.html Sourceforgehttps://sourceforge.net/projects/byteofpython-korean/ 원저 : https://python.swaroopch.com/ 개발/Python 2020.02.24