input (not all the code):
with open(filepath) as f:
reader = csv.reader(f, delimiter=' ')
for line in reader:
print(line)
output (edited):
[f34\t382\t5.00]
[f35\t42\t3.70]
[f36\t72\t1.09]
[f37\t588\t8.56]
[f38\t2837\t7.82]
Question:
How would I replace the text between \t and the second \t with ", "?
>Solution :
Would something like this work for you?
parts = line.split("\t")
result = parts[0] + "," + parts[2]
If you want to keep the tabs then the last line becomes:
result = parts[0] + "\t,\t" + parts[2]