17 ms·
The problem with TSV is what are you going to do about quotes. Some fields might contain them [1] or they might be needed to store fields with tabs inside them.
by ciupicri 2y ago
The problem with TSV is what are you going to do about quotes. Some fields might contain them [1] or they might be needed to store fields with tabs inside them.
Because of this in order to read a plain simple TSV (fields separated by tabs, nothing more) with the Python csv module [2] you need to set the quote character to an improbable value, say € (using the euro sign because HN won't let me use U+1F40D), or just parse it by hand, e.g. row.split('\t').
[1]: https://github.com/wireservice/csvkit/issues/1194 https://github.com/wireservice/csvkit/issues/1194
[2]: https://docs.python.org/3/library/csv.html https://docs.python.org/3/library/csv.html
- makeworld 2y agoQuotes are just characters in TSV. Actual tab characters are banned so this should be simple. (Of course poor implementations may behave differently.)