반응형

Python 39

A Byte of Python

한글판 번역본 HTML :byteofpython-korean.sourceforge.net/byte_of_python.html A Byte of Python지금까지 프로그램을 작성할 때, 우리는 데이터를 다루는 명령들의 블록인 함수들의 조합으로 프로그램을 구성하였습니다. 이러한 설계 방식을 절차 지향 프로그래밍 기법이라고 부릅니다. 이byteofpython-korean.sourceforge.net 원본(영문) HTML :python.swaroopch.com/ Introduction · HonKit"A Byte of Python" is a free book on programming using the Python language. It serves as a tutorial or guide to the Pyt..

개발/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

파이썬 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