沈阳

沈阳的博客

他的个人主页  他的博客

python open mode 'rb' 和 'rt' 的区别

沈阳  2011年01月16日 星期日 19:27 | 4622次浏览 | 0条评论

python open mode 'rb' 和 'rt' 的区别

the big diffrence between binary mode file opening and normal text mode file opening?
Text files contain data that are ASCII text.
They contain ordinary readable characters such as characters, digits, punctuation, and some special characters such as tabs, line breaks, etc.

python open mode 'rb' 和 'rt' 的区别

the big diffrence between binary mode file opening and normal text mode file opening?
Text files contain data that are ASCII text.
They contain ordinary readable characters such as characters, digits, punctuation, and some special characters such as tabs, line breaks, etc.

A Binary file contains non-readable, or only binary characters.
It is a collection of 0s and 1s.

A text file can be considered as a special case of binary files, where text is encoded in the ASCII format.

For more information, visit Wikipedia:
Text_File
Binary_File

Also, text files have lines of text, along with end of line marker at the end of each line.
Whereas, binary files does not. They are not split up into lines or records.

This marker depends upon which operating system you are using.
Macintosh: x'0D'
Unix Based: x'0A'
Windows: x'0D0A'

Reading from a text file is far more easier than reading from a binary file.
Binary file handling is mainly done by using fread and fwrite, which deals with blocks of memories at a time.

引用: http://www.gidforums.com/t-8620.html

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号