0

Currently, I'm looking to scrape the signatures table from the edgar filings for specific companies. I have created a Python program to get down into each document and finds the tables that I need to scrape. I'm having trouble figuring out how to output the data to a file in a 'pretty' way.

Here's a link for a bit of a visual (just scroll to the bottom of the document, there will be a page of signatures there): Example Document

What I'm looking to do is format the table, the same way it is formatted on the website, with each cell taking up a specific amount of space, and filling in unused space with... well, spaces!

My current output:

|Signature, Date, Title|
|/s/ Stanley M. Kuriyama| Chairman of the Board, February 29th, 2016|
|Stanley M. Kuriyama|
|/s/ Christopher J. Benjamin, President, Chief Executive, February 29th, 2016|
|Christopher J. Benjamin, Officer and Director (and so on...)|
|-----------------------------------------------------------------------------|

What I'm looking to do (periods are spaces):

    |Signature......................,Title......................,Date...............|  
    |/s/ Stanley M. Kuriyama,.......,Chairman of the Board,.....,February 29th, 2016|
    |Stanley M. Kuriyama............................................................|  
    |/s/ Christopher J. Benjamin....,President, Chief Executive,February 29th,2016..|      
    |Christopher J. Benjamin,.......,Officer and Director (and so on...)............|
    |-------------------------------------------------------------------------------|

Is there any way to print out the string plus (maxSize -stringSize) number of spaces per cell, so the data looks more tabular? I'm looking to do this with the vanilla Python3, not additional downloads because the people using this program may not be as tech savvy as I am.

Retroflux
  • 57
  • 1
  • 1
  • 9
  • 1
    Welcome to SO. What code have you tried so far? – Richard Erickson May 13 '16 at 15:44
  • Python's string objects contain a format method that will let you specify a width for each 'element' in your format string, and whether to print the element left justified, centered or right justified. For instance `"{:>10}".format("hello")` Try that and see if you can make any progress, paste your actual code after you attempt it here. – Keozon May 13 '16 at 16:41
  • https://docs.python.org/3/library/string.html#format-string-syntax for the full details of format options – Keozon May 13 '16 at 16:44
  • That is exactly what I was looking for, thank you so much! I knew there had to be something in the libraries, I just couldn't find it! Thank you, again! – Retroflux May 16 '16 at 14:03
  • Does this answer your question? [Python String Padding](https://stackoverflow.com/questions/20461421/python-string-padding) – sophros Mar 04 '20 at 12:17

0 Answers0