标签: python stringio
import StringIO output = StringIO.StringIO() output.write('this is the first line\n the new line should come here') a = output.getvalue() output.close() print a
但新行字符\n不会作为新行打印。
\n
如何获取换行符?