-
some_list = [1, 2, 3] for i in some_list: print(i) for s in 'abc': print(s) # a b c for x in ['A', 'B', 'C']: print(x) else: print('printed_all') # A B C printed_all #################################################################### d = {'x': 100, 'y': 200} for v in d: print(v) # x y print(d.items()) # dict_items([('x', 100), ('y', 200)]) for k, v in d.items(): print(k, ':', v)
'python > 기본' 카테고리의 다른 글
Function, kwargs (0) 2022.04.29 range, enumerate, zip (0) 2022.04.29 Input (0) 2022.04.29 While (0) 2022.04.29 If (0) 2022.04.29