ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/RandomCodeRequests/31559/31559.txt
Revision: 742
Committed: Tue Apr 13 20:36:48 2021 UTC (4 years, 11 months ago) by nino.borges
Content type: text/plain
File size: 1474 byte(s)
Log Message:
added some missing code request txt files

File Contents

# Content
1 ### 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 #########################