#!/usr/bin/env python
#coding=utf-8
import StringIO
msg = "Hi! From is StringIO!"
#实例化
s = StringIO.StringIO()
#将数据写入内存
s.write(msg)
#移动读取位置到数据开始
s.seek(0)
#读取内存数据
print s.read()
#!/usr/bin/env python
#coding=utf-8
import StringIO
msg = "Hi! From is StringIO!"
#实例化
s = StringIO.StringIO()
#将数据写入内存
s.write(msg)
#移动读取位置到数据开始
s.seek(0)
#读取内存数据
print s.read()