Thursday, 19 January 2017

converting tsv to csv file-Python

import re
tsv = open('D:\csv to tsv\ggtsvFile.tsv', 'r')
csv = open('D:\csv to tsv\SampleCSVFile_2kb.csv', 'w')
for fileContent in tsv:
    fileContent = re.sub("\t", ",", fileContent)
    print(fileContent)
    csv.write(fileContent)
csv.close()



No comments:

Post a Comment