Context manager to open encoded text file or stdin/stdout
Context manager to open a file or stdin/stdout. Encoding can be detected with chardet. Pass additional arguments to
Python writes BOM for utf-8-sig, utf-16, or utf-32. BOM is not written when endianness is specified.
'-', open stdin (for reading) or stdout (for writing).
'w+', file encoding will be detected using chardet.