Python2.3.4上的错误[FreeBSD]? [英] Bug on Python2.3.4 [FreeBSD]?

查看:81
本文介绍了Python2.3.4上的错误[FreeBSD]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< posted&邮寄>





AFAICT似乎有一个关于FreeBSD的Python 2.3.4开放功能的错误。

文档说明:

<posted & mailed>

Hi,

AFAICT there seems to be a bug on FreeBSD''s Python 2.3.4 open function. The
documentation states:

模式''r +'',''w +''和'a +''打开文件进行更新(注意''w +''
截断文件)。将b附加到模式以在二进制模式下打开文件,在区分二进制文件和文本文件的系统上(否则它将被忽略)。如果无法打开文件,则会引发IOError。
Modes ''r+'', ''w+'' and ''a+'' open the file for updating (note that ''w+''
truncates the file). Append ''b'' to the mode to open the file in binary
mode, on systems that differentiate between binary and text files (else it
is ignored). If the file cannot be opened, IOError is raised.




考虑:


$ cat test

lalala


$ python2.3

Python 2.3.4(#2,2005年1月4日,04:42:43)

[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4

输入help,copyright,credit等等。或许可证或更多信息。



Consider:

$ cat test
lalala

$ python2.3
Python 2.3.4 (#2, Jan 4 2005, 04:42:43)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.

f = open(''test'',''r +'')
f。 read()
''lalala \ n''f.write(''testing'')
f.close()

[1] +停止的python2.3

$ cat test

lalala


- >写不起作用;好的


$ fg

python2.3 f = open(''test'',''a +'')
f.read( )
''''


- >追加模式不读取文件,*不行*

f =打开(''测试'',''w +'')
f.read()
'' ''
f = open(''test'', ''r+'')
f.read() ''lalala\n'' f.write(''testing'')
f.close()
[1]+ Stopped python2.3
$ cat test
lalala

-> write did not work; ok

$ fg
python2.3 f = open(''test'', ''a+'')
f.read() ''''

-> append mode does not read from file, *not ok*
f = open(''test'', ''w+'')
f.read() ''''



$ cat test


- > w +截断文件,确定

任何人都可以确认吗?是否有其他方式打开文件

附加而不是+?


谢谢,

Ciao

Uwe


$ cat test

-> w+ truncated file, ok
Can anyone confirm that? Is there any other way of opening a file for
appending instead of a+?

Thanks,
Ciao
Uwe

推荐答案

猫测试

lalala

cat test
lalala


python2.3

Python 2。3。4(#2,2005年1月4日,04:42:43)

[GCC 2.95 .4 20020320 [FreeBSD]] on freebsd4

输入help,copyright,credit等等。或许可证或更多信息。
python2.3
Python 2.3.4 (#2, Jan 4 2005, 04:42:43)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
f = open(''test'',''r +'')
f。 read()
''lalala \ n''f.write(''testing'')
f.close()

[1] +停止的python2.3
f = open(''test'', ''r+'')
f.read() ''lalala\n'' f.write(''testing'')
f.close()
[1]+ Stopped python2.3


猫测试

lalala


- >写不起作用;好的

cat test
lalala

-> write did not work; ok


这篇关于Python2.3.4上的错误[FreeBSD]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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