padlist
Pad list with default elements.
def padlist(
container: iterable,
size: int,
default: any = None
) - > list
Pad list with default elements.
Parameters
| Name | Type | Description |
|---|---|---|
| container | iterable | The original collection of elements to be padded or truncated |
| size | int | The desired final length of the resulting list |
| default | any = None | The value used to fill the remaining slots if the container is shorter than the target size |
Returns
| Type | Description |
|---|---|
list | A new list containing the original elements truncated or extended with the default value to reach the specified size |