Rev | Line | |
---|
[976] | 1 |
|
---|
| 2 | import re
|
---|
| 3 |
|
---|
| 4 | regex = re.compile('^(\d+) (.*)$')
|
---|
| 5 | pad = ''
|
---|
| 6 |
|
---|
| 7 | filename = 'descriptions.txt'
|
---|
| 8 |
|
---|
| 9 | file = open(filename, 'r')
|
---|
| 10 |
|
---|
| 11 | print('descriptions = {')
|
---|
| 12 |
|
---|
| 13 | for line in file:
|
---|
| 14 | line = line[:-1]
|
---|
| 15 | match = regex.match(line)
|
---|
| 16 | if match:
|
---|
| 17 | code = match.group(1)
|
---|
| 18 | description = match.group(2)
|
---|
| 19 | #description = description.replace("'", "\'")
|
---|
| 20 | print(" %s'%s' : \"%s\"," % (pad, code, description))
|
---|
| 21 |
|
---|
| 22 | print('}')
|
---|
| 23 |
|
---|
| 24 | file.close()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.