连续阅读NUL [英] Conitnue to read through NUL

查看:141
本文介绍了连续阅读NUL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个.dat文件,该文件以ANSI编码,其中包含NUL个字符(不仅是!).

I got a .dat file, encoded in ANSI which contains NUL caracters (not only !).

我不会将其读入一个str对象,它无法在获得的整个str中切出一些东西.

I wan't to read it into a str object iot cut something in the whole str obtained.

但是file.read()在到达第一个NUL时停止.

But file.read() stops when the first NUL is reached.

我迷路了:)

我的代码:

file=open(source, mode='rt')
fulltext=file.read()
print(fulltext)

NUL与Notepad ++一起显示,我在Windows XP上,带有PortablePython 3.2 该文件是特殊的DAT文件,可以使用记事本作为文本进行编辑.

NUL is show with Notepad++ I'm on Windows XP, with PortablePython 3.2 The file is a special DAT file that can be edited with notepad as a text.

推荐答案

正如Evert在我的问题中提到的那样,问题集中在使用Pyscripter上! 因此,此问题已关闭:)

As Evert has commented in my question, the problem was focused on the use of Pyscripter ! So, this question is closed :)

这篇关于连续阅读NUL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆