You have the following code:
id = [int(data[-1]['employee_id'][6:])]
returns a list (i.e the slice
), then the
function will throw an exception.
Then you have:
emp_id = id[-1] + 1
id.append("A2022" + "-" +str(emp_id))
But id is (or should be, and integer value, so you cannot index it, or append anything to it.
There may well be other errors that I have not spotted.
Also, when you post a question here, if your code throws an exception or posts an error message, please
provide the complete details in the question:
- Which line of code it occurs on
- What that code is supposed to do
- The full text of the error
- Any other information that may be relevant