| 34 |
|
... else: |
| 35 |
|
... outputFile.write(line + "\tNO\n") |
| 36 |
|
... |
| 37 |
< |
>>> outputFile.close() |
| 37 |
> |
>>> outputFile.close() |
| 38 |
> |
|
| 39 |
> |
|
| 40 |
> |
""" In this one, she wanted me to cross ref an access table with an excel. (Excel converted to tab delm but access |
| 41 |
> |
I left in mdb, since exporting was super messy.""" |
| 42 |
> |
|
| 43 |
> |
import os,sys, win32com.client |
| 44 |
> |
>>> daoDB = daoEngine.OpenDatabase(r"W:\Manny\Client\Narco\Summation.mdb") |
| 45 |
> |
>>> daoRSObj = daoDB.OpenRecordset("SELECT SUM_SSN FROM Summation") |
| 46 |
> |
>>> daoRSObj.MoveLast() |
| 47 |
> |
>>> fullCount = daoRSObj.RecordCount |
| 48 |
> |
>>> daoRSObj.MoveFirst() |
| 49 |
> |
>>> newList = [] |
| 50 |
> |
>>> for i in range(fullCount): |
| 51 |
> |
... newList.append(daoRSObj.Fields('SUM_SSN').Value) |
| 52 |
> |
... daoRSObj.MoveNext() |
| 53 |
> |
... |
| 54 |
> |
>>> daoRSObj.Close() |
| 55 |
> |
>>> len(newList) |
| 56 |
> |
138407 |
| 57 |
> |
>>> newList.sort() |
| 58 |
> |
>>> fullList = [] |
| 59 |
> |
fullList = [] |
| 60 |
> |
>>> for i in newList: |
| 61 |
> |
... if i: |
| 62 |
> |
... if i == "0": |
| 63 |
> |
... pass |
| 64 |
> |
... else: |
| 65 |
> |
... fullList.append(str(i)) |
| 66 |
> |
... |
| 67 |
> |
>>> len(fullList) |
| 68 |
> |
82527 |
| 69 |
> |
>>> fullList.append('363107041') |
| 70 |
> |
>>> fullList.append('464528121') |
| 71 |
> |
>>> fullList.sort() |
| 72 |
> |
>>> fullList[400] |
| 73 |
> |
'035207139' |
| 74 |
> |
|
| 75 |
> |
>>> contents = open(r"W:\Manny\Client\Narco\20131105_Request\PEC_Internal_Report for 1125 CRMC claims - UAT 11.5.2013.txt").readlines() |
| 76 |
> |
>>> masterMatrix = {} |
| 77 |
> |
>>> for i in contents: |
| 78 |
> |
... parts = i.split("\t") |
| 79 |
> |
... masterMatrix[parts[3]] = i |
| 80 |
> |
... |
| 81 |
> |
>>> len(masterMatrix.keys()) |
| 82 |
> |
|
| 83 |
> |
headder = contents[0] |
| 84 |
> |
>>> outputFile = open(r"W:\Manny\Client\Narco\20131105_Request\PEC_Summation_Crossref_output.txt",'w') |
| 85 |
> |
>>> outputFile.write(headder) |
| 86 |
> |
>>> for ssn in fullList: |
| 87 |
> |
... if ssn in masterMatrix.keys(): |
| 88 |
> |
... outputFile.write(masterMatrix[ssn]) |
| 89 |
> |
... |
| 90 |
> |
>>> outputFile.close() |