0

Counter: 0000,0001,0002

I want to make a counter and use it as string to name a file. Number of digits must be constant. How can I do that in python?

1st Oct 2017, 11:22 AM
Adem Ɵahin
Adem Ɵahin - avatar
1 Answer
+ 5
If you display them as Strings you can use this s = "1" print s.zfill(4) Output : 0001
1st Oct 2017, 11:32 AM
Maksym ZieliƄski
Maksym ZieliƄski - avatar