0

I've made a small database program in Python using SQLite. My goal is to display all my entries that are in my table. I'm able to make that happen, but I have to hit Enter each time.

elif selection == '2': 
  print "Opened database successfully \n"
  cursor = conn.execute("SELECT * FROM DATABASE")
  all = cursor.fetchall()
  for row in all:
    print "ID = ", row[0], "NAME = ", row[1],  "CHECKED IN = ",  row[2], "\n"
    raw_input()

Is there a way I can display them all at once?

I have tired to remove the raw_input but all that does is goes back to my menu.

1
  • Put raw_input() outside your for loop. Commented Jun 8, 2015 at 11:51

1 Answer 1

1

The reason it stops is because you have raw_input() in your loop; you can move it out of your loop:

elif selection == '2': 
   print "Opened database successfully \n"
   cursor = conn.execute("SELECT * FROM DATABASE")
   all = cursor.fetchall()
   for row in all:
      print "ID = ", row[0], "NAME = ", row[1],  "CHECKED IN = ",  row[2], "\n"
   raw_input()

Also, please pay attention to indenting in Python it is critical.

Sign up to request clarification or add additional context in comments.

1 Comment

I should have known it was something so simple. That's why an extra set of eyes are good

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.