Python Forum
Output String Padding help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output String Padding help
#4
Strings have also method for filling in zeros (fills into left side): str.zfill()

>>> s = 'abc'                                                                              
>>> s.zfill(len(s))                                                                        
'abc'
>>> s.zfill(10)
'0000000abc'
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Output String Padding help - by northduckota - Nov-15-2019, 05:09 AM
RE: Output String Padding help - by Larz60+ - Nov-15-2019, 06:17 AM
RE: Output String Padding help - by ThomasL - Nov-15-2019, 06:20 AM
RE: Output String Padding help - by perfringo - Nov-15-2019, 02:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pyplot line color and spacing/padding metalray 0 3,146 May-26-2017, 08:39 AM
Last Post: metalray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020