Quote:
Originally Posted by razorsoup
I am following this post by pchrist7 to add a read status column to Calibre. I would like to pad the percentages with spaces on the left to aid in sorting but cannot figure out how to do so. I have tried changing the line to
Code:
return is_reading_str + ': ' + pct.rjust(3) + '%'
and
Code:
return is_reading_str + ': ' + pct.rjust(3, ' ') + '%'
but neither of these seem to work. If I use
Code:
return is_reading_str + ': ' + pct.rjust(3, '0') + '%'
the percentage is padded with zeros, so the padding seems to work. I guess something is stripping the extra spaces? Is there any way to do what I am trying?
Original post by pchrist7:
|
Hi razorsoup
I'm not that much of a python programmer, but I suspect python only let's you use 0 padding since pct is an integer and rjust is a string function ?
If that's the way it works, you could try to convert pct from int to string before using rjust. Sorry, don't know how to do this. Google might help you.
If you figure it out, please enlighten us all in this thread
Cheers, Per