Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. def find_details(id2find):
  2. db = sqlite3.connect("surfersDB.sdb")
  3. dbrow_factory = sqlite3.Row
  4. cursor = db.cursor()
  5. cursor.execute("select * from surfers")
  6. rows = cursor.fetchall()
  7. for row in rows:
  8. if row['id'] == id2find:
  9. s = {}
  10. s['id'] = int(row['id'])
  11. s['name'] = row['name']
  12. s['country'] = row['country']
  13. s['average'] = str(row['average'])
  14. s['board'] = row['board']
  15. s['age'] = int(row['age'])
  16. cursor.close()
  17. return(s)
  18. cursor.close()
  19. return({})
  20. lookup_id = int(input("Enter the id of the surfer: "))
  21. surfer = find_details(lookup_id)
  22. if surfer:
  23. print("ID: " + surfer['id'])
  24. print("Name: " + surfer['name'])
  25. print("Country: " + surfer['country'])
  26. print("Average: " + surfer['average'])
  27. print("Board type: " + surfer['board'])
  28. print("Age: " + surfer['age'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement