Created
March 9, 2018 08:46
-
-
Save pavelpy/ba33532abb4404f674594839f4f8f238 to your computer and use it in GitHub Desktop.
Exploring encoding defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, locale | |
expressions = """ | |
locale.getpreferredencoding() | |
type(my_file) | |
my_file.encoding | |
sys.stdout.isatty() | |
sys.stdout.encoding | |
sys.stdin.isatty() | |
sys.stdin.encoding | |
sys.stderr.isatty() | |
sys.stderr.encoding | |
sys.getdefaultencoding() | |
sys.getfilesystemencoding() | |
""" | |
my_file = open('dummy', 'w') | |
for expression in expressions.split(): | |
value = eval(expression) | |
print(expression.rjust(30), '->', repr(value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment