---
title: "Discussion on \"Text Alignment in Python\" | Hashnode"
description: "Discussion on \"Text Alignment in Python\". There are methods in python on str class which are used to adjust the padding on texts. Ex:\nhello = 'Hello'\nprint(hello.ljust(21, '-'))\nprint(hello.center(21, '-'))\nprint(hello.rjust(21, '-'))\n\n#Expected output for this would be\nHello----------------..."
url: "https://hashnode.com/posts/text-alignment-in-python/661c1fcd86b015d1024563ce"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Text Alignment in Python](https://rakeshverma.hashnode.dev/text-alignment-in-python?utm_source=hashnode&utm_medium=feed)

There are methods in python on str class which are used to adjust the padding on texts. Ex: hello = 'Hello' print(hello.ljust(21, '-')) print(hello.center(21, '-')) print(hello.rjust(21, '-')) #Expected output for this would be Hello----------------...

Apr 14, 2024 · 2 min read · rakeshverma.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#python3](https://hashnode.com/tag/python3)
-   [#python-beginner](https://hashnode.com/tag/python-beginner)
-   [#python-string-formats](https://hashnode.com/tag/python-string-formats)
-   [#string-formatting](https://hashnode.com/tag/string-formatting)
-   [#string-manipulation](https://hashnode.com/tag/string-manipulation)

## Written by

[Rakesh Verma](https://hashnode.com/@rakeshverma)

@rakeshverma

  
[View profile](https://hashnode.com/@rakeshverma)

Learner of Math, AI, IOT ; Enthusiastic in building new things; Salesforce Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
