반응형

개발/Python 70

A Byte of Python (한국어 번역본) - Google Play Book

A Byte of Python (한국어 번역본) - Google Play Book 바로가기https://play.google.com/books/reader?id=xD96CAAAQBAJ https://play.google.com/books/reader?id=xD96CAAAQBAJ"A Byte of Python" 은 무료로 제공되는 파이썬 프로그래밍 교재입니다. 이 책은 파이썬을 처음 접하는 분들을 위한 튜토리얼 혹은 가이드의 역할을 하도록 쓰여졌습니다. 컴퓨터로 텍스트 문서를 작play.google.com 바로가기 불가 시구글 도서 > 검색 > "A Byte of Python" 입력 후 검색https://play.google.com/store/books/details/Swaroop_C_H_A_Byte_o..

개발/Python 2021.04.22

문자열 포맷별 출력

문자열포맷 구분% 기호 방식{} 기호 방식f-strings 방식출력 결과문자열'%s' % 'string''{}'.format('string')s = 'STRING'; f'{s.lower()}''string'문자'%c' % 0x41'{:c}'.format(0x41)f'{0x41:c}''A'십진수'%d' % 0xFFFF'{:d}'.format(0xFFFF)f'{0xFF00+0x00FF:d}''65535'부동소수'%.2f' % 3.141592'{:.2f}'.format(3.141592)f'{3.141592:.2f}''3.14'16진수(소문자)'%x' % 65535'{:x}'.format(65535)f'{65535:x}''ffff'16진수(대문자)'%X' % 65535'{:X}'.format(65535)f'{6..

개발/Python 2021.04.16

파이썬 튜플(tuple)

튜플은 소괄호('(', ')')로 표시하며 원소를 변경할 수 없다. >>> myTuple = ('a', 'b', 'c', [10, 20, 30], abs, max) >>> myTuple ('a', 'b', 'c', [10, 20, 30], , ) 5번째 원소인 내장함수 abs()에 -100을 파라미터로 전달 >>> myTuple[4](-100) 100 6번째 원소인 내장함수 max()에 리스트([10, 20, 30])를 파라미터로 전달 >>> myTuple[5](myTule[3]) 30 원소 변경 시 >>> myTuple[0] = 'A' TypeError: 'tuple' object does not support item assignment 참조 : (도서) 파이썬 증권 데이터 분석 / 김황후 저

개발/Python 2021.04.16

파이썬 join() 함수

리스트를 인수로 받아서 문자열을 하나로 만든다.>>> myList = ['one', 'two', 'three']>>> myList['one', 'two', 'three'] - 결합하고자 하는 문자를 이용하여 하나의 문자열을 만든다.스페이스(' ')를 이용하여 join>>> ' '.join(myList)'one two three' 컴마(',')를 이용하여 join>>> ', '.join(myList)'one,two,three' 컴마스페이스(', ')를 이용하여 join>>> ', '.join(myList)'one, two, three' 빈문자열('')을 이용하여 join>>> ''.join(myList)'onetwothree'

개발/Python 2021.04.16

파이썬 split() 함수

split() 함수는 문자열을 분리하여 리스트로 만들 때 사용인수가 없으면 빈 스페이스(' ')로 분리하고 인수가 있으면 인수로 분리한다. 인수 없이 분리>>> str = 'one two three'>>> myList = str.split() >>> type(myList) >>> myList['one', 'two', 'three'] 인수 없이 분리하는데 빈 스페이스(' ')가 없는 경우>>> str = 'one,two,three'>>> myList = str.split()>>> myList['one,two,three'] 인수(예, 컴마(','))로 분리>>> str = 'one,two,three'>>> myList = str.split(',')>>> myList['one', 'two', 'three']..

개발/Python 2021.04.16
반응형
LIST