| 1 |
nino.borges |
742 |
### For bmc v IBM (31559) ####
|
| 2 |
|
|
"""
|
| 3 |
|
|
This was a request to find the DocID using a list of sometimes docIDs, some times other fields
|
| 4 |
|
|
and some times the docID was a page in the middle. using a list of all possible values,
|
| 5 |
|
|
this creates a matrix of enumerated values which you can they query.
|
| 6 |
|
|
Pickle of matrix is here:
|
| 7 |
|
|
"""
|
| 8 |
|
|
>>> contents = open(r"C:\Temp\export_20200219_174756.dat").readlines()
|
| 9 |
|
|
>>> contents = contents[1:]
|
| 10 |
|
|
>>> matrix = {}
|
| 11 |
|
|
>>> for line in contents:
|
| 12 |
|
|
... line = line.replace("\n","")
|
| 13 |
|
|
... line = line.replace(quoteChar,"")
|
| 14 |
|
|
... line = line.split(delim)
|
| 15 |
|
|
... if line[1]:
|
| 16 |
|
|
... if line[0][0] == "H":
|
| 17 |
|
|
... pass
|
| 18 |
|
|
... elif line[0][0:3] == "REV":
|
| 19 |
|
|
... pass
|
| 20 |
|
|
... else:
|
| 21 |
|
|
... enum = BatesRangeFunctions.EnumerateBates(line[0],line[1])
|
| 22 |
|
|
... for i in enum:
|
| 23 |
|
|
... matrix[i] = line[0]
|
| 24 |
|
|
... if line[3]:
|
| 25 |
|
|
... enum = BatesRangeFunctions.EnumerateBates(line[2],line[3])
|
| 26 |
|
|
... for i in enum:
|
| 27 |
|
|
... matrix[i] = line[0]
|
| 28 |
|
|
... if line[5]:
|
| 29 |
|
|
... enum = BatesRangeFunctions.EnumerateBates(line[4],line[5])
|
| 30 |
|
|
... for i in enum:
|
| 31 |
|
|
... matrix[i] = line[0]
|
| 32 |
|
|
...
|
| 33 |
|
|
>>> matrix['ATT_00000738']
|
| 34 |
|
|
'H15460-0301-0000335'
|
| 35 |
|
|
|
| 36 |
|
|
## Then write results ##
|
| 37 |
|
|
>>> contents = open(r"C:\Temp\FindIt.txt").readlines()
|
| 38 |
|
|
>>> outputFile = open(r"C:\Temp\FoundIt.txt",'w')
|
| 39 |
|
|
>>> for line in contents:
|
| 40 |
|
|
... line = line.replace("\n","")
|
| 41 |
|
|
... outputFile.write("%s\n"% matrix[line])
|
| 42 |
|
|
...
|
| 43 |
|
|
>>> outputFile.close()
|
| 44 |
|
|
|
| 45 |
|
|
########################## End ######################### |