What value will be returned by center (width, fillchar) method in Python.
Answers
Answered by
0
Explanation:
String alignment is frequently used in many day-day applications. Python in its language offers several functions that helps to align string. Also, offers a way to add user specified padding instead of blank space.
These functions are :
str.ljust(s, width[, fillchar])
str.rjust(s, width[, fillchar])
str.center(s, width[, fillchar])
Answered by
0
The center() method returns a string centered padding with the fillchar specified character.
Explanation:
- Python center() method aligns string to the center by filling paddings left and right of the string using the specified fillchar with total width as specified. The default filler is a space.
- This method requires two parameters: the first is width and the second is an optional fillchar. The fillchar is a character used to fill the string's padding left and right. The method center() will center the string alignment, using a given character (space is the default) as the fill character.
Similar questions