Skip to content

Instantly share code, notes, and snippets.

@kshitij10496
Created September 2, 2017 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kshitij10496/e6ce35c04533b340658004399953199b to your computer and use it in GitHub Desktop.
Save kshitij10496/e6ce35c04533b340658004399953199b to your computer and use it in GitHub Desktop.
Python Source Code File Encoding
# coding: utf-8
from __future__ import print_function
original_string = 'abc∂´ƒ©'
unicode_literal = u'abc∂´ƒ©'
unicode_string = 'abc∂´ƒ©'.decode('utf-8')
print('Original String =', original_string)
print('Type =', type(original_string))
print('Representation =', repr(original_string))
print('----------')
print('Unicode Literal =', unicode_literal)
print('Type =', type(unicode_literal))
print('Representation =', repr(unicode_literal))
print('----------')
print('Unicode String =', unicode_string)
print('Type =', type(unicode_string))
print('Representation =', repr(unicode_string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment