
Creating Divider Lines in Python
By @Jin5 min read

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--------------
Related Articles
- How to read and write JSON files in Python
- Python: Effective Techniques for Managing Dates in DataFrame
- Four Types of Bar Charts in Python - Based on Tabular Data
- Four Types of Bar Charts in Python - Based on Array Data
- How to Use the Concat Function in Pandas for Horizontal or Vertical Table Concatenation
The newsletter
Data in the Age of AI
Exploring how AI is reshaping business intelligence, data architecture, and the way organizations work with data. Get new essays from @Jin delivered to your inbox.
Visit the publication on Substack →Add Comments
Comments
Loading comments...