Formating string with list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Formating string with list

How to get rid of '0' before list in the code: scores=['F', 'D', 'C', 'B'] print(f'Scores: {0:20}',scores)

8th May 2019, 1:17 PM
Bartek Sobura
Bartek Sobura - avatar
3 Answers
+ 11
You may be looking for something like this: scores=['F', 'D', 'C', 'B'] print(f'Scores: {str(scores):>40}')
8th May 2019, 3:00 PM
Cépagrave
Cépagrave - avatar
+ 7
print(f'Scores: {"":20}', scores)
8th May 2019, 1:52 PM
Diego
Diego - avatar
+ 5
use print(f'Scores: {scores}') result is Scores: ['F', 'D', 'C', 'B']
8th May 2019, 2:45 PM
Lothar
Lothar - avatar