1
0

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.

技術英語 > zip() stops when the shortest sequence is done > itertools のzip_longest()を教えていただきました

1
Last updated at Posted at 2017-03-07

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic
(No. 2241 / 12833)

zip() stops when the shortest sequence is done

alist = [ 'A', 'B', 'C', 'D' ]
blist = [ 1, 2, 3 ]

for alph, num in zip(alist, blist):
	print(alph, num)
結果
Success	time: 0 memory: 23352 signal:0
('A', 1)
('B', 2)
('C', 3)

教えていただいた事項

(追記 2017/03/24)

@Tsutomu-KKE@github さんのコメントにてitertools のzip_longest()を教えていただきました。

情報感謝です。

1
0
2

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?