Do I have to do StringIO.close()?

前端 未结 4 1236
旧时难觅i
旧时难觅i 2021-02-05 01:45

Some code:

import cStringIO

def f():
    buffer = cStringIO.StringIO()
    buffer.write(\'something\')
    return buffer.getvalue()

The docume

4条回答
  •  长情又很酷
    2021-02-05 02:34

    StringIO.close() is merely a convenience for routines that take a file-like and eventually attempt to close them. There is no need to do so yourself.

提交回复
热议问题