Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39516 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2013-02-22 13:42 +1100 |
| Last post | 2013-02-22 13:42 +1100 |
| 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.
Re: NamedTemporaryFile does not match documentation Chris Angelico <rosuav@gmail.com> - 2013-02-22 13:42 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-02-22 13:42 +1100 |
| Subject | Re: NamedTemporaryFile does not match documentation |
| Message-ID | <mailman.2235.1361500927.2939.python-list@python.org> |
On Fri, Feb 22, 2013 at 1:10 PM, Jason Friedman <jsf80238@gmail.com> wrote:
>> 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.
Yep, that looks like a docs bug (it was probably copied straight in
from the 2.x docs). Nice and easy to fix, you could submit a patch
with the bug report and make the devs love you!
ChrisA
Back to top | Article view | comp.lang.python
csiph-web