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

  • SEARCH
  • Home
  • 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 3235230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:28:58+00:00 2026-05-17T17:28:58+00:00

I’m designing a weather program where I need to keep track of certain things

  • 0

I’m designing a weather program where I need to keep track of certain things and allow the user to add data which will be saved and subsequently read later. My fields are

City
State
Zip
Metar

I might have more I want to do with this configuration file later, so I would like it to have something like this:

[LOCATIONS]
Phoenix:AZ:85001:KPHX
Dallas:TX:75201:KDFW

[USER CONFIGS]
for later

Setting up to write the file shouldn’t be very hard, just create the file object to write to, write the [Locations] followed by the data that I plan on keeping together in lists and just join the lists with the colon.

However, I’m a little stumped on how to read it back in.

I know I can read the line in one at a time and check if line == ‘[LOCATIONS]’ for example, and read the lines after until I come to a blank line, but what if there is an extra blank line. Or should I do a startswith(‘[‘) and just not add blank lines.

Tried to do some googling online because this looks like it would be a fairly frequent problem for new programers, but I have come up empty (except some learning about the CVS module, which I don’t think can help me here).

A formal database using sqlite would be overkill. At most there will likely be 20-50 entries for each user, most would be less.

Also in the program, each item of data (except state) entered in the GUI can result in all the others being updated with the correct values. Since almost every data item can act as a lead, I’m not sure how I should set this up for easy searching. Should I make a dictionary for City that would include a structure like {‘Dallas’:(‘TX’, ‘75201’, ‘KDFW’)} to help with lookup one for Metars {‘KDFW’: (‘Dallas’, ‘TX’, ‘75201’)} and Zips {‘75201’: (‘DALLAS’, ‘TX’, ‘KDFW’)}? This seems a little better than iterating over each line to check for a match, but seems a bit of a waste considering the original structure will be a list like [‘Dallas’, ‘TX’, ‘75201’, ‘KDFW’]. What would be nice as a dictionary-like object that could have each item in it act like a key returning the other values in the association.

Various thoughts and ideas are appreciated.

  • 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-17T17:28:59+00:00Added an answer on May 17, 2026 at 5:28 pm

    To store data, you may use XML. Then read it off using any XML parser, SAX or DOM which are included with python.

    Since the size of data is very less (only around 20-25 entries per user), you can take the approach of first knowing about the search term, whether its state name or whether its pin code etc. (Ask user to enter this in GUI).

    Assuming that data is stored as [City State Pin Mater], you can then search in the respective column. e.g if the user enters 12345, and you know it’s a pin, you only need to search in the 3rd index of the list-data and then return the list. For state name you would search in the 2nd column.

    And this approach works even if the number of records is large, say a couple of hundreds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.