튜플 또는 시퀀스를 개별 변수로 나누기¶
In [2]:
p = (10, 20)
x, y = p
print(x, y)
In [46]:
sido = ('서울', '부산', '인천')
seoul, busan, inchon = sido
print("seoul = ", seoul, ", busan = ", busan, ", inchon = ", inchon)
In [6]:
data = ['ABCD', 10, 20, (2021, 1, 5)]
name, sum, total, date = data
print(name, sum, total, date)
In [8]:
name, sum, total, (year, month, day) = data
print(name, sum, total, year, month, day)
In [10]:
hello = "Hello"
a, b, c, d, e = hello
print(a, b, c, d, e)