Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: NamedTemporaryFile does not match documentation

Reply
Thread Tools

Re: NamedTemporaryFile does not match documentation

 
 
Jason Friedman
Guest
Posts: n/a
 
      02-22-2013
> 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...odule-tempfile.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: NamedTemporaryFile does not match documentation Jason Friedman Python 0 02-22-2013 05:57 AM
Re: NamedTemporaryFile does not match documentation Chris Angelico Python 0 02-22-2013 02:42 AM
Re: NamedTemporaryFile does not match documentation Serhiy Storchaka Python 0 02-21-2013 09:30 PM
Re: NamedTemporaryFile does not match documentation Chris Angelico Python 0 02-21-2013 08:54 PM
NamedTemporaryFile does not match documentation Jason Friedman Python 0 02-21-2013 08:46 PM



Advertisments