1

I came across a print statement with f strings which was as below:

a = "data"
print(f">{a:^10}<")

The output that i get out of this is as below:

>   data   <

What i would like to understand is the ^10 in the above print statement. Can someone explain?

2
  • Why not read the documentation? Commented Aug 5, 2020 at 5:09
  • See if this documentation helps you pyformat.info Commented Aug 5, 2020 at 5:40

1 Answer 1

4

^ is for center aligned, and 10 means the minimum width.

You can check the format string syntax here.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.