Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: NamedTemporaryFile does not match documentation (http://www.velocityreviews.com/forums/t957914-re-namedtemporaryfile-does-not-match-documentation.html)

Jason Friedman 02-22-2013 02:10 AM

Re: NamedTemporaryFile does not match documentation
 
> 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.


All times are GMT. The time now is 10:55 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.