How do I convert a .tsv to .csv?

后端 未结 4 2082
旧时难觅i
旧时难觅i 2020-12-17 00:46

Trying to convert a .tsv to a .csv. This:

import csv

# read tab-delimited file
with open(\'DataS1_interactome.tsv\',\'rb\') as fin:
    cr = csv.reader(fin         


        
4条回答
  •  没有蜡笔的小新
    2020-12-17 01:28

    import pandas as pd 
    tsv_file='name.tsv'
    csv_table=pd.read_table(tsv_file,sep='\t')
    csv_table.to_csv('new_name.csv',index=False)
    

    We can use the above code to convert the .tsv file to .csv file

提交回复
热议问题