-
Notifications
You must be signed in to change notification settings - Fork 3
Labels
refactoringRewrite / rename / move code etc.Rewrite / rename / move code etc.
Milestone
Description
Then implement the Examples as unit tests.
Originally posted by @lguerard in #49 (comment)
python-imcflibs/src/imcflibs/imagej/misc.py
Lines 601 to 623 in f0a1c9c
| def pad_number(index, pad_length=2): | |
| """Pad a number with leading zeros to a specified length. | |
| Parameters | |
| ---------- | |
| index : int or str | |
| The number to be padded | |
| pad_length : int, optional | |
| The total length of the resulting string after padding, by default 2 | |
| Returns | |
| ------- | |
| str | |
| The padded number as a string | |
| Examples | |
| -------- | |
| >>> pad_number(7) | |
| '07' | |
| >>> pad_number(42, 4) | |
| '0042' | |
| """ | |
| return str(index).zfill(pad_length) |
Metadata
Metadata
Assignees
Labels
refactoringRewrite / rename / move code etc.Rewrite / rename / move code etc.
Type
Projects
Status
Done