By the looks of the question,
I assume that the input file is in csv format and the IOB2 format looks as though it is space or tab separated tokens. So the simplest way to achieve that format would be to read each line and replace the comma delimiter with a space.
# fill in your paths here, do not copy and paste
output = open(OUTFILE_PATH, 'w')
input = open(INPUT_PATH,'r')
data = input.readlines()
input.close()
for line in data:
output_line = line.replace("\n","")
# if the format requires a space then replace with a space
# if the format requires a tab then replace with a tab
# since your file seems to be comma separated,
#that is why I replace the comma below with a space
output_line = output_line.replace(","," ")
out_file.write(output_line+'\n')
out_file.close()
Hope this helps!
2
solved can i convert 3-gram txt to iob for crf suite