Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

No project description provided

Project description

Read Python3 Source File With Correct Encoding

according to, python3 source file encoding are default to be utf-8.

But open()'s encoding will be gbk on windows, So don't use open without encoding to read a python3 source file.


from read_source import get_encoding, read
print(get_encoding('tests/source/gb18030/')) # gb18030
with read('tests/source/gb18030/') as f:
    # -*- coding: gb18030 -*-

Project details

Download files

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

Files for read-source, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size read_source-0.0.2-py3-none-any.whl (1.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size read_source-0.0.2.tar.gz (1.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page