Revision 7989,
1.2 KB
checked in by daisuke, 11 years ago
(diff) |
forked.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[7989] | 1 | #!/usr/bin/python |
---|
| 2 | |
---|
| 3 | f = open("MonitorsDB", "r") |
---|
| 4 | out = open("MonitorsDBOut", "w") |
---|
| 5 | |
---|
| 6 | monIds = dict() |
---|
| 7 | |
---|
| 8 | for line in f.readlines(): |
---|
| 9 | if len(line.strip()) and not line.strip().startswith('#'): |
---|
| 10 | values = map(lambda x: x.strip(), line.split(';')) |
---|
| 11 | if len(values) < 5: |
---|
| 12 | print "This line contains two few values\n%s" % line |
---|
| 13 | manufacturer = values[0] |
---|
| 14 | model = values[1] |
---|
| 15 | monId = values[2] |
---|
| 16 | vGh = values[3] |
---|
| 17 | hGh = values[4] |
---|
| 18 | if len(manufacturer) == 0: |
---|
| 19 | print "This line doesn't contain Manufacturer\t%s" % line |
---|
| 20 | continue |
---|
| 21 | if len(model) == 0: |
---|
| 22 | print "This line contains empty model\t%s" % line |
---|
| 23 | continue |
---|
| 24 | if len(monId) == 0 or monId == "0": |
---|
| 25 | print "This line contains empty monitor Id\n%s" % line |
---|
| 26 | continue |
---|
| 27 | if len(vGh) == 0 or len(hGh) == 0: |
---|
| 28 | print "This line contains wrong Gh\t%s" % line |
---|
| 29 | continue |
---|
| 30 | if monIds.has_key(monId): |
---|
| 31 | print "Two line have the same monitor Ids\n%s%s" % (monIds[monId], line) |
---|
| 32 | continue |
---|
| 33 | else: |
---|
| 34 | monIds[monId] = line |
---|
| 35 | out.write(line) |
---|
| 36 | f.close() |
---|
| 37 | out.close() |
---|
| 38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.