Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc38bc04
Commit
cc38bc04
authored
Jul 27, 2006
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example
parent
e9db0a47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
Doc/lib/libstringio.tex
Doc/lib/libstringio.tex
+37
-0
No files found.
Doc/lib/libstringio.tex
View file @
cc38bc04
...
...
@@ -37,6 +37,24 @@ such mixing can cause this method to raise \exception{UnicodeError}.
Free the memory buffer.
\end{methoddesc}
Example usage:
\begin{verbatim}
import StringIO
output = StringIO.StringIO()
output.write('First line.
\n
')
print >>output, 'Second line.'
# Retrieve file contents -- this will be
# 'First line.
\nSecond
line.
\n
'
contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception.
output.close()
\end{verbatim}
\section
{
\module
{
cStringIO
}
---
Faster version of
\module
{
StringIO
}}
...
...
@@ -82,3 +100,22 @@ The following data objects are provided as well:
There is a C API to the module as well; refer to the module source for
more information.
Example usage:
\begin{verbatim}
import cStringIO
output = cStringIO.StringIO()
output.write('First line.
\n
')
print >>output, 'Second line.'
# Retrieve file contents -- this will be
# 'First line.
\nSecond
line.
\n
'
contents = output.getvalue()
# Close object and discard memory buffer --
# .getvalue() will now raise an exception.
output.close()
\end{verbatim}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment