
Creating Divider Lines in Python

Basic Divider Line
The simplest way to create a divider line in Python is to use the format method with the ^
option to center align a character within a specified width. Let's see an example:
print("{:=^50s}".format("Split Line"))
The output will look like this:
====================Split Line====================
Customizing Divider Lines
You can easily customize the appearance of the divider line by changing the fill character and adjusting the width.
print("{:-^50s}".format("Split Line"))
print("{:*^50s}".format("Split Line"))
print("{:'^50s}".format("Split Line"))
The output for these examples will be:
``` --------------------Split Line--------------
2024-01-23
Related Articles
Add Comments
Comments
Loading comments...