File: openClosedUniGenerator.py

package info (click to toggle)
defcon 0.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,988 kB
  • sloc: python: 12,306; makefile: 66
file content (24 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import print_function
import os

path = os.path.join(os.path.dirname(__file__), "UnicodeData.txt")

f = open(path, "r")
text = f.read()
f.close()

result = []

openValue = None
for line in text.splitlines():
    line = line.split(";")
    value, name, category = line[:3]
    if category in ("Ps", "Pi"):
        openValue = (value, name, category)
    elif category in ("Pe", "Pf") and openValue is not None:
        result.append("%s;%s;%s" % openValue)
        result.append("%s;%s;%s" % (value, name, category))
        result.append("")
        openValue = None

print("\n".join(result))