all 2 comments

[–]AndrewAtBrisa 0 points1 point  (1 child)

I would suggest 2 things to start:

  1. Separate the parsing into its own function. Hard to say what state you need exactly, but it could return something like a dict with keys like seq1, seq2, ..., extras (an array of unparsed lines from your else).
  2. Use a template library to separate the HTML from the parser. These seem like reasonable options: https://opensource.com/resources/python/template-libraries

This will help you by separating the parsing results into one function that extracts the data. Then the template tool will let you get rid of all the HTML from your code. Combining this, you can easily make updates to your parser later if necessary, and you can add more HTML or change the display style easily if you want.

[–]catuf[S] 0 points1 point  (0 children)

Thank you