Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def center_for_output(label, width=78, pad_character="_", prefix="|[002|w",
- label_format="|u{}|n|[002|w"):
- """Center and format a label for output.
- Args:
- label: The label to center.
- width: The width to center within. Default 78.
- pad_character: The character to pad the label with. Default "_".
- prefix: Formatting to prefix the line with.
- label_format: Formatting to wrap the label in, string format style.
- Returns:
- width wide string, with formatting characters.
- """
- centered_label = label_format.center(width + len(label_format), pad_character).format(label)
- return(prefix + centered_label)
Advertisement
Add Comment
Please, Sign In to add comment