Created
April 9, 2009 21:49
-
-
Save kriskowal/92762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from StringIO import StringIO | |
buffer = StringIO() | |
buffer.write('Hello,') | |
buffer.write(' ') | |
buffer.write('World!') | |
assert buffer.getvalue() == 'Hello, World!' | |
buffer = StringIO(buffer.getvalue()) | |
assert buffer.read(7) == "Hello, " | |
assert buffer.read() == "World!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment