[Python] 2개의 리스트의 요소들을 합쳐서 딕셔너리 타입으로 변환 2개의 동일한 길이의 리스트를 키와 값으로 이루어진 딕셔너리로 변경 list_A = ['a','b','c'] list_B = [1, 2, 3] list_C = { x:y for x,y in zip(list_A,list_B) } list_C {'a': 1, 'b': 2, 'c': 3} Python/Python Programming 2019.10.14
[Python] if 조건문에서 자료형의 참(True)과 거짓(False) 파이썬 자료형의 참(True)과 거짓(False) 자료형 참(True) 거짓(False) 숫자 0이 아닌 정수 0 문자열 'python' '' 리스트 ['a','b','c'] [ ] 튜플 ('a','b','c') ( ) 딕셔너리 {'a':'b'} { } 1. 문자열 if 'python': print(True) else: print(False) ---------------- True if '': print(True) else: print(False) ---------------- False 2. 숫자 if 123: print(True) else: print(False) ---------------- True if 0: # 0 -> False print(True) else: print(False) -----.. Python/Python Programming 2018.05.07