
import sys

def add_character(unicodespec, characterstore):
    characterstora

def main(raw, out):
    # Fetch upper and lower case characters in Unicode
    characters = filter(lambda x: x[2] == 'Lu' or x[2] == 'Ll', raw)
    image = [unichr(int(c[0], 16)) for c in characters]
    output = u"\n".join(image)
    out.write(output.encode("UTF-8"))
    out.write(u"\n".encode("UTF-8"))

if __name__ == '__main__':
    try:
        raw = [x.split(";") for x in open("./UnicodeData.txt", "r").readlines()]
    except:
        sys.stderr.write("Problems reading ./UnicodeData.txt.\n")
        sys.exit(1)
    main(raw, sys.stdout)


import sys

def add_character(unicodespec, characterstore):
    characterstora

def main(raw, out):
    # Fetch upper and lower case characters in Unicode
    characters = [x for x in raw if x[2] == 'Lu' or x[2] == 'Ll']
    image = [chr(int(c[0], 16)) for c in characters]
    output = "\n".join(image)
    out.write(output.encode("UTF-8"))
    out.write(u"\n".encode("UTF-8"))

if __name__ == '__main__':
    try:
        raw = [x.split(";") for x in open("./UnicodeData.txt", "r").readlines()]
    except:
        sys.stderr.write("Problems reading ./UnicodeData.txt.\n")
        sys.exit(1)
    main(raw, sys.stdout)

Migrate script ot Python 3
Migrate script ot Python 3

  
  import sys
  
  def add_character(unicodespec, characterstore):
      characterstora
  
  def main(raw, out):
      # Fetch upper and lower case characters in Unicode
-     characters = filter(lambda x: x[2] == 'Lu' or x[2] == 'Ll', raw)
+     characters = [x for x in raw if x[2] == 'Lu' or x[2] == 'Ll']
-     image = [unichr(int(c[0], 16)) for c in characters]
+     image = [chr(int(c[0], 16)) for c in characters]
-     output = u"\n".join(image)
+     output = "\n".join(image)
      out.write(output.encode("UTF-8"))
      out.write(u"\n".encode("UTF-8"))
  
  if __name__ == '__main__':
      try:
          raw = [x.split(";") for x in open("./UnicodeData.txt", "r").readlines()]
      except:
          sys.stderr.write("Problems reading ./UnicodeData.txt.\n")
          sys.exit(1)
      main(raw, sys.stdout)
  
Migrate script ot Python 3
## Code Before:

import sys

def add_character(unicodespec, characterstore):
    characterstora

def main(raw, out):
    # Fetch upper and lower case characters in Unicode
    characters = filter(lambda x: x[2] == 'Lu' or x[2] == 'Ll', raw)
    image = [unichr(int(c[0], 16)) for c in characters]
    output = u"\n".join(image)
    out.write(output.encode("UTF-8"))
    out.write(u"\n".encode("UTF-8"))

if __name__ == '__main__':
    try:
        raw = [x.split(";") for x in open("./UnicodeData.txt", "r").readlines()]
    except:
        sys.stderr.write("Problems reading ./UnicodeData.txt.\n")
        sys.exit(1)
    main(raw, sys.stdout)

## Instruction:
Migrate script ot Python 3
## Code After:

import sys

def add_character(unicodespec, characterstore):
    characterstora

def main(raw, out):
    # Fetch upper and lower case characters in Unicode
    characters = [x for x in raw if x[2] == 'Lu' or x[2] == 'Ll']
    image = [chr(int(c[0], 16)) for c in characters]
    output = "\n".join(image)
    out.write(output.encode("UTF-8"))
    out.write(u"\n".encode("UTF-8"))

if __name__ == '__main__':
    try:
        raw = [x.split(";") for x in open("./UnicodeData.txt", "r").readlines()]
    except:
        sys.stderr.write("Problems reading ./UnicodeData.txt.\n")
        sys.exit(1)
    main(raw, sys.stdout)
