[Python] 병행성(Concurrency)(1) - basic
iterable 객체 - 반복 가능한 객체iterator 객체 - 값을 차례대로 꺼낼 수 있는 객체 iterable 객체 # 반복 가능한 이유? -> 내부적으로 iter() 함수 호출t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'# for 반복for c in t: print(c, end=' ') --------------------------------------------[result]A B C D E F G H I J K L M N O P Q R S T U V W X Y Z iterator 객체 a=t.__iter__()print([next(a) for _ in range(len(t))])# ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', ..
[Python] 고급 - Dict 및 Set(2) - Sequence(4)
Immutable Dict # immutable Dictfrom types import MappingProxyTyped = {'key1': 'value1'}f = dprint('f = d : ', d is f, d == f) # is 는 id 가 같은지 확인, == 는 값이 같은지 확인print('value & id: ', d, id(d))print('value & id: ', f, id(f))print()# Read Only(Immutable Dict 생성)d_frozen = MappingProxyType(d)print(d, id(d), type(d))print(d_frozen, id(d_frozen), type(d_frozen))print(d is d_frozen, d == d_frozen) # is..
[Python] 고급 - 리스트 및 튜플(2) - Sequence(2)
컨테이너 타입 자료형(Container : 서로다른 자료형[list, tuple, collections.deque], a = [3, 3.5, 'a'] # 서로 다른 자료형, 컨네이너 타입 자료형 Flat : 한 개의 자료형[str, bytes, bytearray, array.array, memoryview])한개의 자료형만 저장, 빠름, 자연어 처리, 숫자, 이산, 회계분석, 기상데이터 등 단일 형태의 연산 가변(list, bytearray, array.array, memoryview, deque)불변(tuple, str, bytes)Unpacking # Tuple Advanced# Unpacking# b, a = a, bprint(divmod(100, 9))print(divmod(*(100, 9)))p..
[Python] 고급 - 리스트 및 튜플(1) - Sequence(1)
컨테이너 타입 자료형(Container : 서로다른 자료형[list, tuple, collections.deque], a = [3, 3.5, 'a'] # 서로 다른 자료형, 컨네이너 타입 자료형 Flat : 한 개의 자료형[str, bytes, bytearray, array.array, memoryview])한개의 자료형만 저장, 빠름, 자연어 처리, 숫자, 이산, 회계분석, 기상데이터 등 단일 형태의 연산 가변(list, bytearray, array.array, memoryview, deque)불변(tuple, str, bytes) # 지능형 리스트(Comprehending Lists)# Non Comprehending Listschars = '+_)(*&^%$#@!~)'code_list1 = []f..