Advertisement
Koopcio

update

Nov 14th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. def choose():
  2. FILE_PATH = '/home/codecool/Pulpit/PythonMK/lightweight-erp-python-isem/hr/persons.csv'
  3. inputs = ui.get_inputs(["Please enter a number: "], "")
  4. option = inputs[0]
  5. table = data_manager.get_table_from_file(FILE_PATH)
  6. if option == "1":
  7. show_table(table)
  8. if option == "2":
  9. show_table(table)
  10. table = add(table)
  11. if option == "3":
  12. show_table(table)
  13. id = ui.get_inputs(["Please enter id: "], "")
  14. remove(table, id)
  15. if option == "4":
  16. id = ui.get_inputs(["Please enter ID to update"], "")
  17. table = update(table,id)
  18. show_table(table)
  19. sys.exit()
  20. if option == "0":
  21. return False
  22.  
  23.  
  24.  
  25.  
  26. for i in range(len(table)):
  27. rec = table[i]
  28. if id_[0] == rec[0]:
  29. list_of_labels = ['Enter ID','Enter Name','Enter Year']
  30. title = 'Update a record with ID = %s' % id_[0]
  31. rec = ui.get_inputs(list_of_labels,title)
  32. table[i] = rec
  33.  
  34. return table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement