1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Python】リストをアンパックする(複数の変数に展開する)【備忘】

Posted at

自分用の記事です。

間違ってたらごめんなさい。

こんなことをしてしまった

lst = [0, 1, 2]
a, b, c = lst[0], lst[1], lst[2]

すごく非効率

こうすればよかった

a, b, c = lst
print(a)
print(b)
print(c)
# 0
# 1
# 2

以上。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?