#!/usr/bin/env python # coding: utf-8 # # Encoding # # ## Goals # # - A string is more than a sequence of bytes # - A string is a couple (bytes, encoding) # - Use unicode_literals in python2 # - Manage differently encoded filenames # - A string is not a sequence of bytes # ## Modules # In[ ]: import os import os.path import glob # In[ ]: from os.path import isdir basedir = "/tmp/course" if not isdir(basedir): os.makedirs(basedir) # # Song of Childhood # #
# Als das Kind Kind war, # ging es mit hängenden Armen, # wollte der Bach sei ein Fluß, # der Fluß sei ein Strom, # und diese Pfütze das Meer. # # Als das Kind Kind war, # wußte es nicht, daß es Kind war, # alles war ihm beseelt, # und alle Seelen waren eins. # # | #
#
# characters were bytes, and # strings list of bytes." # |
# # When the child was a child # It walked with its arms swinging, # wanted the brook to be a river, # the river to be a torrent, # and this puddle to be the sea. # # When the child was a child, # it didn’t know that it was a child, # everything was soulful, # and all souls were one. # # | #