当前位置: 主页 > 日志 > 其它 >

TSV格式

TSV 是Tab-separated values的缩写,即制表符分隔值。

相对来说CSV,Comma-separated values(逗号分隔值)更常见一些。

 

TSV与CSV的区别:

1)从名称上即可知道,TSV是用制表符(Tab,'\t')作为字段值的分隔符;CSV是用半角逗号(',')作为字段值的分隔符;

2)IANA规定的标准TSV格式,字段值之中是不允许出现制表符的。

 

Python对TSV文件的支持:

Python的csv模块准确的讲应该叫做dsv模块,因为它实际上是支持范式的分隔符分隔值文件(DSV,delimiter-separated values)的。

delimiter参数值默认为半角逗号,即默认将被处理文件视为CSV。

当delimiter='\t'时,被处理文件就是TSV。

详情见这里:http://docs.python.org/library/csv.html

 

关于TSV更详细的说明:http://en.wikipedia.org/wiki/Tab-separated_values

 

A tab-separated values file is a simple text format for a database table. Each record in the table is one line of the text file. Each field value of a record is separated from the next by a tab stop character – it is a form of the more general delimiter-separated values format.

TSV is a simple file format that is widely supported, so it is often used to move tabular data between different computer programs that support the format. For example, a TSV file might be used to transfer information from a database program to a spreadsheet.

TSV is an alternative to the common comma-separated values (CSV) format, which often causes difficulties because of the need to escape commas – literal commas are very common in text data, but literal tab stops are infrequent in running text. The IANA standard for TSV achieves simplicity by simply disallowing tabs within fields.

 

[日志信息]

该日志于 2012-02-19 08:52 由 redice 发表在 redice's Blog ,你除了可以发表评论外,还可以转载 “TSV格式” 日志到你的网站或博客,但是请保留源地址及作者信息,谢谢!!    (尊重他人劳动,你我共同努力)
   
验证(必填):   点击我更换验证码

redice's Blog  is powered by DedeCms |  Theme by Monkeii.Lee |  网站地图 |  本服务器由西安鲲之鹏网络信息技术有限公司友情提供

返回顶部