0
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 1 year has passed since last update.

ゼロ埋めリストの作成

Last updated at Posted at 2022-01-04

追記
より良い例をご教授いただきましたので、コメント欄をご覧ください。

>>> a = [i.zfill(2) for i in list(map(str, range(10)))]
>>> a
['00', '01', '02', '03', '04', '05', '06', '07', '08', '09']

list(map(str, range(10)))は数列を文字列としてリスト化(リスト化は不要).
[i.zfill(2) for i in list(...)]は中身を一つずつ取り出してゼロ埋めし,リスト化

0
0
3

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
0
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?