| 1 |
ninoborges |
8 |
Random Code.
|
| 2 |
|
|
|
| 3 |
|
|
Just some random one off code that I used to help my teamates with their data manip
|
| 4 |
|
|
requests.
|
| 5 |
|
|
|
| 6 |
|
|
|
| 7 |
|
|
|
| 8 |
|
|
|
| 9 |
|
|
----------Helping Sherila with reformatting her OCR txt files. Making them base 8
|
| 10 |
|
|
>>> for file in os.listdir(r"\\ercdis20\dis01\C_D\66369011\GLL0002CONF\OCR"):
|
| 11 |
|
|
... (bates,extension) = os.path.splitext(file)
|
| 12 |
|
|
... prefix = 'GLL'
|
| 13 |
|
|
... num = bates.replace(prefix,"")
|
| 14 |
|
|
... num = str(num)
|
| 15 |
|
|
... while len(num) <8:
|
| 16 |
|
|
... num = "0" + num
|
| 17 |
|
|
... o.Copy(r'\\ercdis20\dis01\C_D\66369011\GLL0002CONF\OCR' + "\\" + file, prefix+num+extension, r'C:\test_dir\sherila',0)
|
| 18 |
|
|
...
|
| 19 |
|
|
|
| 20 |
|
|
|
| 21 |
|
|
---------Helping Felecia with making her produced native files have the same name as her
|
| 22 |
|
|
produced tiff files
|
| 23 |
|
|
|
| 24 |
|
|
>>> matrix = {}
|
| 25 |
|
|
>>> for line in contents: #contents was an XFD file
|
| 26 |
|
|
... line = line.split("|")
|
| 27 |
|
|
... bates = line[0].replace(" ", "")
|
| 28 |
|
|
... matrix[bates] = line[2]
|
| 29 |
|
|
...
|
| 30 |
|
|
|
| 31 |
|
|
>>> for file in os.listdir(workingDir):
|
| 32 |
|
|
... (name,extension) = os.path.splitext(file)
|
| 33 |
|
|
... name = name.rstrip()
|
| 34 |
|
|
... name = name.upper()
|
| 35 |
|
|
... o.Copy(workingDir + "\\" + file, matrix[name] + extension, outputDir + "\\", 0)
|
| 36 |
|
|
...
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
|