Issue
print(f'{"Progress":2} {"Trailer":3} {"Retriver":4} {"Excluded":5}')
print(f'{"*":2} {"*":3} {"*":4} {"*":5}')
The print function prints it as:
Progress Trailer Retriver Excluded
* * * *
How can I align the star signs under the right column?
Solution
Try the below code, it will assign fixed column width and center the words:
print(f'{"Progress":^10} {"Trailer":^10} {"Retriver":^10} {"Excluded":^10}')
print(f'{"*":^10} {"*":^10} {"*":^10} {"*":^10}')
It will give output as below:
Progress Trailer Retriver Excluded
* * * *
Answered By - Shubham
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.