print spacing with {:23} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

print spacing with {:23}

name = "Gordon" response ="My name is {}".format(name) print("{:23}".format(response)) Why {:23} fails to spacing?🤔

25th Oct 2018, 2:23 PM
Gordon
Gordon - avatar
2 Answers
+ 1
It is spaced, but with left alignment. So you probably didn't notice. Try name = "Gordon" response ="My name is {}".format(name) print("{:23} Chan.".format(response)) If you want right alignment, use {:>23}
25th Oct 2018, 3:11 PM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
😲It works! Now I can help the others out~ 😆
25th Oct 2018, 3:24 PM
Gordon
Gordon - avatar