Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39513 > unrolled thread

Re: NamedTemporaryFile does not match documentation

Started byJason Friedman <jsf80238@gmail.com>
First post2013-02-21 18:10 -0800
Last post2013-02-21 18:10 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: NamedTemporaryFile does not match documentation Jason Friedman <jsf80238@gmail.com> - 2013-02-21 18:10 -0800

#39513 — Re: NamedTemporaryFile does not match documentation

FromJason Friedman <jsf80238@gmail.com>
Date2013-02-21 18:10 -0800
SubjectRe: NamedTemporaryFile does not match documentation
Message-ID<mailman.2232.1361499042.2939.python-list@python.org>
> NamedTemporaryFile by default opens a file in binary mode ('w+b'). Write
> bytes or specify text mode.
>
>>>> f.write(b"Hello World!\n")
> 13
>>>> ft = NamedTemporaryFile('w+', delete=False)
>>>> ft.write("Hello World!\n")
> 13

Thank you Chris and Serhiy, that helped.  I'm inclined to open a
documentation bug because I could not reproduce the code/output
snippet on page
http://docs.python.org/release/3.2.2/library/tempfile.html#module-tempfile.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web