a = 'apple', 'banana', 'mango'
b = 1, 2, 3
list_test = list(zip(a, b))
print(list_test)
# >>> [('apple', 1), ('banana', 2), ('mango', 3)]
dict_test = dict(zip(a, b))
print(dict_test)
# >>> {'apple': 1, 'banana': 2, 'mango': 3}
'Python > Python__works' 카테고리의 다른 글
collections (0) | 2019.06.12 |
---|---|
python slacker 한글 깨지는 현상 (0) | 2019.06.11 |
set combinations and operators (0) | 2019.06.03 |
Dictionaries (0) | 2019.06.03 |
introducing python - strings (0) | 2019.05.31 |