Introducing StringIO : StringIO : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » StringIO »

 

Introducing StringIO


import string

contents = "<grammar><ref id='bit'><para>0</para><para>1</para></ref></grammar>" 
import StringIO 
ssock = StringIO.StringIO(contents)          
print ssock.read()                                      
print ssock.read()                                     
print ssock.seek(0)                                      
print ssock.read(15)                                       
print ssock.read(15
print ssock.read() 
ssock.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» StringIO