Skip to content

Instantly share code, notes, and snippets.

@ychoi-kr
Created May 19, 2021 04:28
Show Gist options
  • Save ychoi-kr/159b95f68e38518324cc85583c33e6eb to your computer and use it in GitHub Desktop.
Save ychoi-kr/159b95f68e38518324cc85583c33e6eb to your computer and use it in GitHub Desktop.
Python format string
>>> for n in range(3, 20, 3):
... print(f'{n:2d}')
...
3
6
9
12
15
18
>>> for n in range(3, 20, 3):
... print(f'{n:02d}')
...
03
06
09
12
15
18