How to convert tab separated, pipe separated to CSV file format in Python
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a text file (.txt) which could be in tab separated format or pipe separated format, and I need to convert it into CSV file format. I am using python 2.6. Can any one suggest me how to identify the delimiter in a text file, read the data and then convert that into comma separated file. Thanks in advance 回答1: I fear that you can't identify the delimiter without knowing what it is. The problem with CSV is, that, quoting ESR : the Microsoft version of CSV is a textbook example of how not to design a textual file format. The delimiter