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 7619223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:37:56+00:00 2026-05-31T03:37:56+00:00

I am storing the values of the form given below into a file: 143

  • 0

I am storing the values of the form given below into a file:

143   800 'Ask'
213   457 'Comment'
424   800 'Hi'

The first column contains unique elements here.
However, the look up on the values of the first column is quite inefficient when I am storing it in file format, is there a more efficient way in Python for a faster look-up.
I am aware of dictionaries in python for accomplishing this, but I am looking for some other method. Since the data I have consits of trillions of records..therefore I can not keep them in dictionary in the RAM. Therefore, I am searching for some other method.
Also with each program exection the rows are going to be inserted in the case of databases, how to overcome that, an example of what I am getting confused about in databases is given below:

 143   800 'Ask'
 213   457 'Comment'
 424   800 'Hi'
 143   800 'Ask'
 213   457 'Comment'
 424   800 'Hi'
  • 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-31T03:37:57+00:00Added an answer on May 31, 2026 at 3:37 am

    Here’s a full code example using sqlite3, showing how to initialise the database, put data into it, and get a single row of data out.

    import sqlite3
    
    conn = sqlite3.connect(':memory:')
    conn.execute("""CREATE TABLE Widget (id INTEGER PRIMARY KEY,
                                         serial_number INTEGER,
                                         description TEXT);""")
    
    my_data = [ [143, 800, 'Ask'],
                [213, 457, 'Comment'],
                [424, 800, 'Hi'] ]
    
    for row in my_data:
        conn.execute("INSERT INTO Widget (id, serial_number, description) VALUES (?,?,?);" , row )
    
    conn.commit() # save changes
    
    res = conn.execute("SELECT * FROM Widget WHERE id=143")
    row = res.next()
    print row #prints (143, 800, u'Ask')
    

    Note the use of the special filename :memory: to open a temporary database.

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

Sidebar

Related Questions

I have a form I've built in PHP and storing the form field values
So, storing a Java String into a form hidden input value. I call said
// This is the file that is giving the error, not the form below
Given the array below, how do I get values of object(stdClass) such as Pcv
I have simple form like this which accepts only two values string action and
I am receiving long string of checked html checkbox values (Request.Form[mylist] return Value1,Value2,Value3....) on
SQLite docs specifies that the preferred format for storing datetime values in the DB
I'm creating a multiform application in c#. I'm storing the values from the user
I'm considering storing some date values as ints. i.e 201003150900 Excepting the fact that
What are the typical arguments in support of storing combo-box values (static lookup values

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.