阅读背景:

用替换字符替换文本文件中的重复分隔符

来源:互联网 

I am attempting to process a large pipe "|" delimited, double quote qualified text file (>700,000 records, >3,000 characters per record, and 28 fields per record). using a python script. I am encountering a problem as the csv parser is parsing fields incorrectly due to unescaped double quote characters and pipes embedded within the text of a field in the file. Since tabs are not present in the file I would like to convert it to a tab delimited file by replacing the double-quote-pipe-double-quote delimiter/qualifier character sequence ("|") with tabs (\t). This would be relatively straightforward if every field was populated but some are not. Fields that are not populated are represented by a null string so I can have anywhere from 1 to 7 pipe delimiters in sequence prefaced by a double quote.I am attempting to process a large pipe "|" del




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: