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.

5
  • 1
    Welcome to SO. What code have you tried so far? Commented May 13, 2016 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. Commented May 13, 2016 at 16:41
  • docs.python.org/3/library/string.html#format-string-syntax for the full details of format options Commented May 13, 2016 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! Commented May 16, 2016 at 14:03
  • Does this answer your question? Python String Padding Commented Mar 4, 2020 at 12:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.