homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, georg.brandl, peterdemin
Date 2008年06月26日.12:41:23
SpamBayes Score 0.029977921
Marked as misclassified No
Message-id <1214484086.6.0.727644375269.issue3207@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, the exact behaviour depends on multiple aspects.
You should follow the C library conventions: 
http://www.cplusplus.com/reference/clibrary/cstdio/fopen.html
"""
For the modes where both read and writing (or appending) are allowed
(those which include a "+" sign), the stream should be flushed (fflush)
or repositioned (fseek, fsetpos, rewind) between either a reading
operation followed by a writing operation or a writing operation
followed by a reading operation.
"""
In your case, I suggest a call to fp.seek(0, os.SEEK_CUR) before you
start writing data. And a fp.flush() after, in case you want to read again.
Python 3.0 has a completely new I/O implementation, which may have its
own problems, but hopefully the same on all platforms. And it happens to
do the right thing in your example.
History
Date User Action Args
2008年06月26日 12:41:27amaury.forgeotdarcsetspambayes_score: 0.0299779 -> 0.029977921
recipients: + amaury.forgeotdarc, georg.brandl, peterdemin
2008年06月26日 12:41:26amaury.forgeotdarcsetspambayes_score: 0.0299779 -> 0.0299779
messageid: <1214484086.6.0.727644375269.issue3207@psf.upfronthosting.co.za>
2008年06月26日 12:41:25amaury.forgeotdarclinkissue3207 messages
2008年06月26日 12:41:24amaury.forgeotdarccreate

AltStyle によって変換されたページ (->オリジナル) /