I want to print a string in a sexy aligned way but I can't see what I'm doing wrong?
I would like to achieve this:
15 OBJECT (7) Content Placeholder 5
17 BODY (2) Text Placeholder 1
18 BODY (2) Text Placeholder 2
23 OBJECT (7) Content Placeholder 3
24 PICTURE (18) Picture Placeholder 4
25 BODY (2) Text Placeholder 6
My code:
for shape in slide.placeholders:
print '{0:<5} {1} {2:<5}'.format(shape.placeholder_format.idx,
shape.placeholder_format.type,
shape.name)
But this is what I get
15 OBJECT (7) Content Placeholder 5
17 BODY (2) Text Placeholder 1
18 BODY (2) Text Placeholder 2
23 OBJECT (7) Content Placeholder 3
24 PICTURE (18) Picture Placeholder 4
25 BODY (2) Text Placeholder 6
FYI - doing this: print '{0:<5} {1:<15} {2:<5}'.format(...)
gives me this:
15 7 Content Placeholder 5
17 2 Text Placeholder 1
18 2 Text Placeholder 2
23 7 Content Placeholder 3
24 18 Picture Placeholder 4
25 2 Text Placeholder 6
It kinda eats into my middle column of text?
Aucun commentaire:
Enregistrer un commentaire