Skip to main content

Python file/stdio context manager which detects encoding

Project description

Context manager to open a file or stdin/stdout. Encoding can be detected with chardet. Pass additional arguments to open().

Python writes BOM for utf-8-sig, utf-16, or utf-32. BOM is not written when endianness is specified.

Differences from open()

If file=None or file='-', open stdin (when reading) or stdout (when writing) instead.

If encoding=None and mode='r' or 'w+', then detect file encoding using chardet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bom_open-0.3.2.tar.gz (2.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page