tsv_csv.py 402 Bytes
Newer Older
Rafael Artinano's avatar
Rafael Artinano committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import re
 
# reading given tsv file
with open("uniprotkb_protein_name_AND_model_organi_2024_01.tsv", 'r') as myfile:  
  with open("protein_name.csv", 'w') as csv_file:
    for line in myfile:
       
      # Replace every tab with comma
      fileContent = re.sub("\t", ";", line)
       
      # Writing into csv file
      csv_file.write(fileContent)
 
# output
print("Successfully made csv file")