# open a file called employee for reading
emp = open("employee.txt")
# open the van wyk file for writting so we can add all employee with the van wyk surname
vanwyk= open("vanwyk.txt", "w")
anotherEmp = open("anothe.txt.", "w")
totvanwyk = 0 # to count the total number of employees with the surname  van wyk
# for loop that will go through each record in a file
for record in emp
  number,surname,initials,salary = record.split(",") # 1,van wyk, j,3000
  if surname == "van wyk": 
    # write all the employees details whose surname is van wyk into a file
    vanwyk,write("",joinrecord) + "\r")
    totvanwyk= totvanwyk + 1 # To count the total number of employees with the surname  van wyk
    
     else:
       another Emp.writer(""join(record) + "\r") # Adding all other employees in a file called another
        print("",join(record)) # Print each employee details)
        Print("The total number of employee with the surname van wyk is:", totvanwyk)
vanwyk.close()
anotherEmp.close()
emp.close()

vanwyk = open("vanwyk,txt", "r") # openned the van wyk file for reading

for rec in vanwyk
   rec = vanwyk.readline() # Allows to read all the records in the van wyk file
   print(rec)
   
   vanwyk.close()
 
by