-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathiphoneback.py
More file actions
44 lines (36 loc) · 1.08 KB
/
Copy pathiphoneback.py
File metadata and controls
44 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from prettytable import PrettyTable
import sqlite3
conn = sqlite3.connect('3d0d7e5fb2ce288813306e4d4636395e047a3d28')
c = conn.cursor()
def tablename():
x = PrettyTable(["Table name"])
x.align = "l"
for row in c.execute("SELECT name FROM sqlite_master WHERE type='table'"):
x.add_row(row)
print x
def messages():
x = PrettyTable(["Account", "Message"])
x.align = "l"
for row in c.execute("SELECT account, text FROM message"):
x.add_row(row)
print x
## Text menu in Python
def print_menu(): ## Your menu design here
print 30 * "-" , "MENU" , 30 * "-"
print "1. Show Tables"
print "2. Show Messages"
print "3. Exit"
print 67 * "-"
loop=True
while loop: ## While loop which will keep going until loop = False
print_menu() ## Displays menu
choice = input("Enter your choice [1-3]: ")
if choice==1:
tablename()
elif choice==2:
messages()
elif choice==3:
print "Exiting...."
loop=False
else:
raw_input("Wrong option selection. Enter any key to try again..")