1

I was wondering if I can use a simpler method to print("{:<3} {:<30} {:<30}".format(x+1, cam, img)).

I'm using print(f"including a variable named var : {var}")

instead of print("including a variable named var :{}".format(var))

But with the f"" I can't find a method to put minimal margin unlike "{:<30}".format(var)

Thanks for help !

1 Answer 1

3

You can add the variable name before the : character to get the same result:

>>> name = "Tom"
>>> print(f"{name:>3} {name:>30}")

Tom                            Tom
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.