Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6565631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:07:05+00:00 2026-05-25T14:07:05+00:00

I wish to send Python script a definition file (with key and value pairs)

  • 0

I wish to send Python script a definition file (with key and value pairs) which it should translate into an html table using templates.

For example:
say that the definitions file def.txt contain the following lines:

build number: 5513
build date: 12/09/2011

I want it to be able to read it easily (iterate on each line) and create a data table.
something like:

<tbl>
   <tr> <td> build number </td> <td> 5515 </td> </tr>
   <tr> <td> build date </td> <td> 12/09/2011</td> </tr>
</tbl>

I want it to work for N lines in definition file. I don’t care about the definition file format…

Any suggestions?

Thanks.

Or.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:07:06+00:00Added an answer on May 25, 2026 at 2:07 pm
    >>> l = [i.split(": ") for i in open("def.txt")] #read and parse the input
    >>> l #here is what we got
    [['build number', '5513'], ['build date', '12/09/2011']]
    >>> with open("out.txt", "w") as f: #open the out file
    ...    f.write("<tbl>\n") 
    ...    for k, v in l: #iterate and write
    ...         f.write("<tr><td>{}</td><td>{}</td></tr>\n".format(k, v)) 
    ...    f.write("</tbl>\n")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to search a database table on a nullable column. Sometimes the value
I wish to send an email, with a plain text and html version. The
I'm trying to send intent to browser to open local file. I wish to
I have a small client server application in which i wish to send an
I wish to send mail to an administrator when the application crashes. So I
I wish to send an email from my localhost machine (using PHPs mail function)
I wish to send text between processes. I have found lots of examples of
I wish to code a little service where I will be able to send
I wish to implement a 2d bit map class in Python. The class would
I have written this short script (which I've stripped away some minor detail for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.