Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39513
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jsf80238@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'binary': 0.05; 'snippet': 0.09; 'bug': 0.10; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; 'inclined': 0.16; 'reproduce': 0.16; 'bytes': 0.17; 'specify': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'subject:skip:d 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; '>>>>': 0.29; 'mode.': 0.29; "i'm": 0.29; 'mode': 0.30; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'received:google.com': 0.34; 'text': 0.34; 'open': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'thank': 0.36; 'subject:: ': 0.38; 'url:docs': 0.38; 'page': 0.38; 'skip:n 10': 0.63; 'subject:skip:N 10': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=L0urCen2Fo3Mra+P9psw2t38hJuugao/xorVn2jVEpk=; b=i8F16befgYoP17OdbSe+CTfPzNtqGBcluSCRlA3+zt6xy1BLhysdO/C2Gk8nkUEHV4 8JUq3IywS+v8FUNoTe6tO1/PtiZxnUhgtmyWAA5qFmbp9xXmu/5RsfOgp5bJzyiVvPmN qfH1ySkPd0/URbaztD1B3Q5kKg4MA1Bchs0IPqwF/JJT832+EmS8QctZLzogEom/ixFw chaK6yEgeGhtz/74woq0wz4rCdBx4kgxMFj9yZDdPaFRt+Ief08zWjnLH7xvPc9TRz8H IhnmNMD7/36zhaAENmeNx6ciwbBLmNwcn77rABL8YEp2KesTU+HbK0JWOH9dZKa7hpea StmA== |
| MIME-Version | 1.0 |
| X-Received | by 10.42.215.196 with SMTP id hf4mr98937icb.23.1361499040305; Thu, 21 Feb 2013 18:10:40 -0800 (PST) |
| In-Reply-To | <kg63kp$742$1@ger.gmane.org> |
| References | <CANy1k1g4eJ+9aBArQm_r8k0iKKuaxf_wzKjdEjOkj7M0J7=N8A@mail.gmail.com> <kg63kp$742$1@ger.gmane.org> |
| Date | Thu, 21 Feb 2013 18:10:40 -0800 |
| Subject | Re: NamedTemporaryFile does not match documentation |
| From | Jason Friedman <jsf80238@gmail.com> |
| To | Serhiy Storchaka <storchaka@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2232.1361499042.2939.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361499042 news.xs4all.nl 6878 [2001:888:2000:d::a6]:42213 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39513 |
Show key headers only | View raw
> 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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: NamedTemporaryFile does not match documentation Jason Friedman <jsf80238@gmail.com> - 2013-02-21 18:10 -0800
csiph-web