goal
Implements left-aligned, right-aligned, and center-aligned strings.
methodologies
Strings have the following built-in methods: where width is the width including the string S, fillchar defaults to a space, or you can specify a fill character
Copy Code The code is as follows.
(s, width[, fillchar])
(s, width[, fillchar])
(s, width[, fillchar])
Copy Code The code is as follows.
In [6]: a='Hello!'
In [7]: print (10,'+')
Hello!++++
In [8]: print (10,'+')
++++Hello!
In [9]: print (10,'+')
++Hello!++