How to center a string in specific width using Python

2 Answers

0 votes
s = "Python"
print(s.center(12))


'''
run:

   Python   

'''

 



answered Dec 13, 2017 by avibootz
0 votes
s = "Python"
print(s.center(14, "*"))


'''
run:

****Python****

'''

 



answered Dec 13, 2017 by avibootz
...