Convert tab-delimited txt file into a csv file using Python
问题 So I want to convert a simple tab delimited text file into a csv file. If I convert the txt file into a string using string.split(\'\\n\') I get a list with each list item as a string with \'\\t\' between each column. I was thinking I could just replace the \'\\t\' with a comma but it won\'t treat the string within the list like string and allow me to use string.replace. Here is start of my code that still needs a way to parse the tab \"\\t\". import csv import sys txt_file = r\"mytxt.txt\"