I'd like to do it in an elegant fashion:
>>> ''.zfill(5, '-')
'-----'
There's any way to initialize a string with a fill char and a counter? Of course, count may vary.
Just try:
>>> '-'*5
'-----'
It's that simple in Python :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With