smpl_io.io.write

smpl_io.io.write(destination, content, mode='w+', create_dir=True)[source]

Write to file by string or writable destiantion.

Parameters

destinationstr, writeable

destination to write to.

contentstr

text to be written.

modestr

mode to open the file. Default is ‘w+’ (write and read).

create_dirbool

create directory if it does not exist.

Examples

>>> write(sys.stdout,"hi")
hi
>>> write("test.out","hi")
>>> read("test.out")
'hi'