source: people/peter.buschman/backup_monitoring/parsing/parsers/bperrcode/txt2py.py@ 976

Last change on this file since 976 was 976, checked in by peter, on Dec 6, 2011 at 10:19:33 AM

Raw checkin of current NetBackup / TSM parsing code.

File size: 462 bytes
Line 
1
2import re
3
4regex = re.compile('^(\d+) (.*)$')
5pad = ''
6
7filename = 'descriptions.txt'
8
9file = open(filename, 'r')
10
11print('descriptions = {')
12
13for 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
22print('}')
23
24file.close()
Note: See TracBrowser for help on using the repository browser.