Fixed compatibility with Python 2.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 01 Sep 2021 10:03:45 +0300
changeset 1315 6532512bbac4
parent 1314 3bd48b5e12c6
child 1316 870abedea142
Fixed compatibility with Python 2.
py/gadict_c5.py
--- a/py/gadict_c5.py	Wed Sep 01 09:59:04 2021 +0300
+++ b/py/gadict_c5.py	Wed Sep 01 10:03:45 2021 +0300
@@ -121,7 +121,7 @@
             FOUT.write("]")
         if len(hw.attrs) > 0:
             FOUT.write(" ")
-            l = ["«"+x+"»" for x in hw.attrs]
+            l = [u"«"+x+u"»" for x in hw.attrs]
             l.sort()
             FOUT.write(", ".join(l))
         if hw.homo is not None and len(hw.homo) > 0:
@@ -135,9 +135,9 @@
         if not sense:
             raise Exception("""Empty sense for article: """ + headwords.__iter__().__next__())
         if sense.pos:
-            FOUT.write("● «")
+            FOUT.write(u"● «")
             FOUT.write(sense.pos)
-            FOUT.write("»")
+            FOUT.write(u"»")
             need_sep = False
             if sense.topic_list and len(sense.topic_list) > 0:
                 FOUT.write(" topic: ")
@@ -186,7 +186,7 @@
             FOUT.write("  ")
             if not LANGS or len(LANGS) > 1:
                 FOUT.write(lang)
-                FOUT.write("→ ")
+                FOUT.write(u"→ ")
             FOUT.write(tr)
             FOUT.write("\n")
         for (lang, tr) in sense.glos_list or []:
@@ -195,7 +195,7 @@
             FOUT.write("  ")
             if not LANGS or len(LANGS) > 1:
                 FOUT.write(lang)
-            FOUT.write("↦ ")
+            FOUT.write(u"↦ ")
             FOUT.write(tr)
             FOUT.write("\n")
         for (lang, tr) in sense.ex_list or []:
@@ -204,7 +204,7 @@
             FOUT.write("    ")
             if not LANGS or len(LANGS) > 1:
                 FOUT.write(lang)
-            FOUT.write("⇒ ")
+            FOUT.write(u"⇒ ")
             FOUT.write(tr)
             FOUT.write("\n")
     freqtags = []