| 1 |
PythonWin 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32.
|
| 2 |
Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for further copyright information.
|
| 3 |
>>> contents = open(r"\\lisdisdss01\ercdis12\Admin\Share\Manny\03-22-2011_Archives_Found.txt").readlines()
|
| 4 |
>>> sizeList = []
|
| 5 |
>>> kbList = []
|
| 6 |
>>> mb list = []
|
| 7 |
Traceback ( File "<interactive input>", line 1
|
| 8 |
mb list = []
|
| 9 |
^
|
| 10 |
SyntaxError: invalid syntax
|
| 11 |
>>> mbList = []
|
| 12 |
>>> gbList = []
|
| 13 |
>>> for i in contents:
|
| 14 |
... if "MB" in i:
|
| 15 |
... mbList.append(i.replace(" MB",'')
|
| 16 |
... elif "GB" in i:
|
| 17 |
Traceback ( File "<interactive input>", line 4
|
| 18 |
elif "GB" in i:
|
| 19 |
^
|
| 20 |
SyntaxError: invalid syntax
|
| 21 |
>>> for i in contents:
|
| 22 |
... if "MB" in i:
|
| 23 |
... mbList.append(i.replace(" MB",''))
|
| 24 |
... elif "GB" in i:
|
| 25 |
... gbList.append(i.replace(" GB",''))
|
| 26 |
... elif "KB" in i:
|
| 27 |
... kbList.append(i.replace(" KB",''))
|
| 28 |
... else:
|
| 29 |
... print i
|
| 30 |
...
|
| 31 |
\\lisdisdss01\ercdis02\F\Data\C_D3\54168061\030417_1012\Industry Data.zip|126 bytes
|
| 32 |
|
| 33 |
\\lisdisdss01\ercdis03\E\C_D\61786014\DATABASE50\ATTACH.zip|448 bytes
|
| 34 |
|
| 35 |
\\lisdisdss01\ercdis11\F\C_D\55771140C\ATTACH0037\000000007F61E097BBD8374984C63ABEB5368788A4002600.#1.aparik 0track.zip|505 bytes
|
| 36 |
|
| 37 |
\\lisdisdss01\ercdis11\F\C_D\55771140C\ATTACH0025\00000000DE90F03E95DD4A4B861E5A408B5F5A35442E2200.#2.aparikh 1track.zip|505 bytes
|
| 38 |
|
| 39 |
\\lisdisdss01\ercdis11\F\C_D\55771140\ATTACH0060\834c97b38f2c.fca5d@eagle.net.#1.eagle4425.zip|22 bytes
|
| 40 |
|
| 41 |
\\lisdisdss01\ercdis11\F\C_D\55771140\ATTACH0057\635c6b4620c6d411909100508bcfe67a101b61a0@zrtpd0jd.us.nortel.com.#1.mcs_5200_aug04.zip|519 bytes
|
| 42 |
|
| 43 |
\\lisdisdss01\ercdis11\H\C_D\37354873\Replace_Attach_BOX064.ZIP|372 bytes
|
| 44 |
|
| 45 |
\\lisdisdss01\ercdis11\I\C_D\73655018\CHAPA004P.zip|22 bytes
|
| 46 |
|
| 47 |
\\lisdisdss01\ercdis11\I\C_D\73655018\MEISDIPA023R.zip|22 bytes
|
| 48 |
|
| 49 |
\\lisdisdss01\ercdis11\I\C_D\73655018\MEISDIPA024P_Tiffs.zip|22 bytes
|
| 50 |
|
| 51 |
\\lisdisdss01\ercdis11\I\C_D\73655017\MEISDICA032P_Tiffs.zip|22 bytes
|
| 52 |
|
| 53 |
\\lisdisdss01\ercdis11\I\C_D\73655017\MEISDICA034P_Tiffs.zip|22 bytes
|
| 54 |
|
| 55 |
\\lisdisdss01\ercdis11\I\C_D\73655017\PRICECA002_Tiffs.zip|22 bytes
|
| 56 |
|
| 57 |
\\lisdisdss01\ercdis11\O\C_D\37354873\Redelivery 1\BOX001.ZIP|430 bytes
|
| 58 |
|
| 59 |
\\lisdisdss01\ercdis11\O\C_D\37354873\Redelivery 1\BOX003.ZIP|698 bytes
|
| 60 |
|
| 61 |
\\lisdisdss01\ercdis12\F\C_D\71116087\MEISTX032 Excel DB.ZIP|116 bytes
|
| 62 |
|
| 63 |
\\lisdisdss01\ercdis12\F\C_D\71116087\MEISTX033 EXCEL DB.ZIP|116 bytes
|
| 64 |
|
| 65 |
\\lisdisdss01\ercdis12\E\C_D\65784026\NISSLEY008\NativeFiles.zip|122 bytes
|
| 66 |
|
| 67 |
\\lisdisdss01\ercdis12\E\C_D\65784026\BRADT016\NativeFiles.zip|122 bytes
|
| 68 |
|
| 69 |
>>> kbList = []
|
| 70 |
>>> mbList = []
|
| 71 |
>>> gbList = []
|
| 72 |
>>> for i in contents:
|
| 73 |
... i = i.split("|")[1]
|
| 74 |
... if "MB" in i:
|
| 75 |
... mbList.append(i.replace(" MB",''))
|
| 76 |
... elif "GB" in i:
|
| 77 |
... gbList.append(i.replace(" GB",''))
|
| 78 |
... elif "KB" in i:
|
| 79 |
... kbList.append(i.replace(" KB",''))
|
| 80 |
... else:
|
| 81 |
... print i
|
| 82 |
...
|
| 83 |
126 bytes
|
| 84 |
|
| 85 |
448 bytes
|
| 86 |
|
| 87 |
505 bytes
|
| 88 |
|
| 89 |
505 bytes
|
| 90 |
|
| 91 |
22 bytes
|
| 92 |
|
| 93 |
519 bytes
|
| 94 |
|
| 95 |
372 bytes
|
| 96 |
|
| 97 |
22 bytes
|
| 98 |
|
| 99 |
22 bytes
|
| 100 |
|
| 101 |
22 bytes
|
| 102 |
|
| 103 |
22 bytes
|
| 104 |
|
| 105 |
22 bytes
|
| 106 |
|
| 107 |
22 bytes
|
| 108 |
|
| 109 |
430 bytes
|
| 110 |
|
| 111 |
698 bytes
|
| 112 |
|
| 113 |
116 bytes
|
| 114 |
|
| 115 |
116 bytes
|
| 116 |
|
| 117 |
122 bytes
|
| 118 |
|
| 119 |
122 bytes
|
| 120 |
|
| 121 |
>>> mbList[0]
|
| 122 |
'3.40\n'
|
| 123 |
>>> mbList[1]
|
| 124 |
'3.74\n'
|
| 125 |
>>> kbList = []
|
| 126 |
>>> mbList = []
|
| 127 |
>>> gbList = []
|
| 128 |
>>> for i in contents:
|
| 129 |
... i = i.replace("\n","")
|
| 130 |
... i = i.split("|")[1]
|
| 131 |
... if "MB" in i:
|
| 132 |
... mbList.append(i.replace(" MB",''))
|
| 133 |
... elif "GB" in i:
|
| 134 |
... gbList.append(i.replace(" GB",''))
|
| 135 |
... elif "KB" in i:
|
| 136 |
... kbList.append(i.replace(" KB",''))
|
| 137 |
... else:
|
| 138 |
... print i
|
| 139 |
...
|
| 140 |
126 bytes
|
| 141 |
448 bytes
|
| 142 |
505 bytes
|
| 143 |
505 bytes
|
| 144 |
22 bytes
|
| 145 |
519 bytes
|
| 146 |
372 bytes
|
| 147 |
22 bytes
|
| 148 |
22 bytes
|
| 149 |
22 bytes
|
| 150 |
22 bytes
|
| 151 |
22 bytes
|
| 152 |
22 bytes
|
| 153 |
430 bytes
|
| 154 |
698 bytes
|
| 155 |
116 bytes
|
| 156 |
116 bytes
|
| 157 |
122 bytes
|
| 158 |
122 bytes
|
| 159 |
>>> mbList[1]
|
| 160 |
'3.74'
|
| 161 |
>>> mbTotal = 0
|
| 162 |
>>> for x in mbList:
|
| 163 |
... mbTotal = mbTotal + int(x)
|
| 164 |
...
|
| 165 |
Traceback (most recent call last):
|
| 166 |
File "<interactive input>", line 2, in <module>
|
| 167 |
ValueError: invalid literal for int() with base 10: '3.40'
|
| 168 |
>>> test = '3.14'
|
| 169 |
>>> int(test)
|
| 170 |
Traceback (most recent call last):
|
| 171 |
File "<interactive input>", line 1, in <module>
|
| 172 |
ValueError: invalid literal for int() with base 10: '3.14'
|
| 173 |
>>> long(test)
|
| 174 |
Traceback (most recent call last):
|
| 175 |
File "<interactive input>", line 1, in <module>
|
| 176 |
ValueError: invalid literal for long() with base 10: '3.14'
|
| 177 |
>>> float(test)
|
| 178 |
3.1400000000000001
|
| 179 |
>>> for x in mbList:
|
| 180 |
... mbTotal = mbTotal + float(x)
|
| 181 |
...
|
| 182 |
>>> mbTotal
|
| 183 |
112272.70999999998
|
| 184 |
>>> kbTotal = 0
|
| 185 |
>>> for x in kbList:
|
| 186 |
... kbTotal = kbTotal + int(x)
|
| 187 |
...
|
| 188 |
Traceback (most recent call last):
|
| 189 |
File "<interactive input>", line 2, in <module>
|
| 190 |
ValueError: invalid literal for int() with base 10: '1.32'
|
| 191 |
>>> for x in kbList:
|
| 192 |
... kbTotal = kbTotal + float(x)
|
| 193 |
...
|
| 194 |
>>> kbTotal
|
| 195 |
234184.43999999957
|
| 196 |
>>> gbTotal = 0
|
| 197 |
>>> for x in gbList:
|
| 198 |
... gbTotal = gbTotal + float(x)
|
| 199 |
...
|
| 200 |
>>> gbTotal
|
| 201 |
53.370000000000005
|
| 202 |
>>> gbList
|
| 203 |
['1.06', '1.57', '1.58', '1.04', '1.28', '3.78', '1.02', '1.09', '1.63', '2.14', '3.00', '3.07', '1.90', '1.06', '1.12', '1.08', '1.17', '1.23', '1.84', '1.08', '1.30', '1.04', '1.24', '1.28', '1.82', '1.26', '9.16', '3.53']
|
| 204 |
>>> import MCP_Lib
|
| 205 |
>>> db = MCP_Lib.AccessDBConnection(r"\\chiads01\app\DS_CaseTrack\TPM_CaseTracking.mdb)
|
| 206 |
Traceback ( File "<interactive input>", line 1
|
| 207 |
db = MCP_Lib.AccessDBConnection(r"\\chiads01\app\DS_CaseTrack\TPM_CaseTracking.mdb)
|
| 208 |
^
|
| 209 |
SyntaxError: EOL while scanning single-quoted string
|
| 210 |
>>> db = MCP_Lib.AccessDBConnection(r"\\chiads01\app\DS_CaseTrack\TPM_CaseTracking.mdb")
|
| 211 |
>>> db.GetChargable('072810.0028')
|
| 212 |
False
|
| 213 |
>>> db.GetChargable('039323.0308')
|
| 214 |
False
|
| 215 |
>>> db.GetChargable('072810.0028')
|
| 216 |
True
|
| 217 |
>>> db.GetChargable('071082.0022')
|
| 218 |
False
|
| 219 |
>>> db.UpdateChargable('071082.0022',True)
|
| 220 |
>>> db.GetChargable('071082.0022')
|
| 221 |
True
|
| 222 |
>>> db.CloseAccessConnection()
|
| 223 |
>>> db = ""
|
| 224 |
>>> import time
|
| 225 |
>>> time.localtime()
|
| 226 |
(2011, 3, 23, 13, 53, 41, 2, 82, 1)
|
| 227 |
>>> tm = '20100114'
|
| 228 |
>>> int(time.mktime(time.strptime(tm+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 229 |
1263488400
|
| 230 |
>>> time.mktime
|
| 231 |
<built-in function mktime>
|
| 232 |
>>> time.mktime()
|
| 233 |
Traceback (most recent call last):
|
| 234 |
File "<interactive input>", line 1, in <module>
|
| 235 |
TypeError: mktime() takes exactly one argument (0 given)
|
| 236 |
>>> time.gmtime()
|
| 237 |
(2011, 3, 23, 18, 11, 47, 2, 82, 0)
|
| 238 |
>>> time.gmtime(0)
|
| 239 |
(1970, 1, 1, 0, 0, 0, 3, 1, 0)
|
| 240 |
>>> time.clock()
|
| 241 |
7.669144100962026e-007
|
| 242 |
>>> time.ctime()
|
| 243 |
'Wed Mar 23 14:14:52 2011'
|
| 244 |
>>> time.mktime(time.clock())
|
| 245 |
Traceback (most recent call last):
|
| 246 |
File "<interactive input>", line 1, in <module>
|
| 247 |
TypeError: argument must be 9-item sequence, not float
|
| 248 |
>>> time.time()
|
| 249 |
1300904148.2490001
|
| 250 |
>>> time.mktime(time.time())
|
| 251 |
Traceback (most recent call last):
|
| 252 |
File "<interactive input>", line 1, in <module>
|
| 253 |
TypeError: argument must be 9-item sequence, not float
|
| 254 |
>>> int(time.time())
|
| 255 |
1300904277
|
| 256 |
>>> import os
|
| 257 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\cases"):
|
| 258 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\cases",i)):
|
| 259 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\cases",i)):
|
| 260 |
... if x == 'UploadReport.txt":
|
| 261 |
Traceback ( File "<interactive input>", line 4
|
| 262 |
if x == 'UploadReport.txt":
|
| 263 |
^
|
| 264 |
SyntaxError: EOL while scanning single-quoted string
|
| 265 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\cases"):
|
| 266 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\cases",i)):
|
| 267 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\cases",i)):
|
| 268 |
... if x == 'UploadReport.txt':
|
| 269 |
... print x
|
| 270 |
...
|
| 271 |
Traceback (most recent call last):
|
| 272 |
File "<interactive input>", line 1, in <module>
|
| 273 |
WindowsError: [Error 3] The system cannot find the path specified: 'c:\\documents and settings\\eborges\\my documents\\my dropbox\\cases/*.*'
|
| 274 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 275 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 276 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 277 |
... if x == 'UploadReport.txt':
|
| 278 |
... print x
|
| 279 |
...
|
| 280 |
UploadReport.txt
|
| 281 |
UploadReport.txt
|
| 282 |
UploadReport.txt
|
| 283 |
UploadReport.txt
|
| 284 |
UploadReport.txt
|
| 285 |
UploadReport.txt
|
| 286 |
UploadReport.txt
|
| 287 |
UploadReport.txt
|
| 288 |
UploadReport.txt
|
| 289 |
UploadReport.txt
|
| 290 |
UploadReport.txt
|
| 291 |
UploadReport.txt
|
| 292 |
UploadReport.txt
|
| 293 |
UploadReport.txt
|
| 294 |
UploadReport.txt
|
| 295 |
UploadReport.txt
|
| 296 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 297 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 298 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 299 |
... if x == 'UploadReport.txt':
|
| 300 |
... print i + x
|
| 301 |
...
|
| 302 |
Aziz Zapsu_(084974-0011)UploadReport.txt
|
| 303 |
Citadel_(071082-0022)UploadReport.txt
|
| 304 |
Concentra_(049700-0063)UploadReport.txt
|
| 305 |
DaVita-Dallas_(039323-0308)UploadReport.txt
|
| 306 |
DaVita-GA_(039323-0292)UploadReport.txt
|
| 307 |
EAPD_(084597-0011)UploadReport.txt
|
| 308 |
Engelhorn_(080616-0015)UploadReport.txt
|
| 309 |
Idnani_(083614-0013)UploadReport.txt
|
| 310 |
Littleton Electric_(073987-0010)UploadReport.txt
|
| 311 |
MKS_(086400-0016)UploadReport.txt
|
| 312 |
Porton Capital_(083128-0011)UploadReport.txt
|
| 313 |
Seacoast_(076834-0012)UploadReport.txt
|
| 314 |
StateStreet_(030790-0247)UploadReport.txt
|
| 315 |
Tria_(082185-0012)UploadReport.txt
|
| 316 |
Winn_Companies_(085871-0011)UploadReport.txt
|
| 317 |
Yeadon_(076326-0024)UploadReport.txt
|
| 318 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 319 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 320 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 321 |
... if x == 'UploadReport.txt':
|
| 322 |
... contents = os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x)
|
| 323 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 324 |
... for line in contents:
|
| 325 |
... dt,amnt = line.split("|")
|
| 326 |
... dt = dt.strip()
|
| 327 |
...
|
| 328 |
Traceback (most recent call last):
|
| 329 |
File "<interactive input>", line 8, in <module>
|
| 330 |
ValueError: need more than 1 value to unpack
|
| 331 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 332 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 333 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 334 |
... if x == 'UploadReport.txt':
|
| 335 |
... contents = os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x)
|
| 336 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 337 |
... for line in contents:
|
| 338 |
... dt,amnt = line.split("|")
|
| 339 |
... dt = dt.strip()
|
| 340 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 341 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 342 |
... outputFile.close()
|
| 343 |
...
|
| 344 |
Traceback (most recent call last):
|
| 345 |
File "<interactive input>", line 8, in <module>
|
| 346 |
ValueError: need more than 1 value to unpack
|
| 347 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 348 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 349 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 350 |
... if x == 'UploadReport.txt':
|
| 351 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 352 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 353 |
... for line in contents:
|
| 354 |
... dt,amnt = line.split(" | ")
|
| 355 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 356 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 357 |
... outputFile.close()
|
| 358 |
...
|
| 359 |
Traceback (most recent call last):
|
| 360 |
File "<interactive input>", line 8, in <module>
|
| 361 |
ValueError: need more than 1 value to unpack
|
| 362 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 363 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 364 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 365 |
... if x == 'UploadReport.txt':
|
| 366 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 367 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 368 |
... for line in contents:
|
| 369 |
... dt,amnt = line.split(" | ")
|
| 370 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 371 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 372 |
... outputFile.close()
|
| 373 |
...
|
| 374 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 375 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 376 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 377 |
... if x == 'UploadReport.txt':
|
| 378 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 379 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 380 |
... for line in contents:
|
| 381 |
... dt,amnt = line.split(" | ")
|
| 382 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 383 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 384 |
... outputFile.close()
|
| 385 |
...
|
| 386 |
>>> test = 0
|
| 387 |
>>> '12:00:%0*d'%(2,test)
|
| 388 |
'12:00:00'
|
| 389 |
>>> test = 13
|
| 390 |
>>>
|
| 391 |
>>> '12:00:%0*d'%(2,test)
|
| 392 |
'12:00:13'
|
| 393 |
>>> test = 8
|
| 394 |
>>> '12:00:%0*d'%(2,test)
|
| 395 |
'12:00:08'
|
| 396 |
>>> counter = 0
|
| 397 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 398 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 399 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 400 |
... if x == 'UploadReport.txt':
|
| 401 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 402 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 403 |
... for line in contents:
|
| 404 |
... dt,amnt = line.split(" | ")
|
| 405 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 406 |
... preepoch = epoch
|
| 407 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 408 |
... outputFile.close()
|
| 409 |
>>> preepoch = int(time.mktime(time.strptime('20120101'+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 410 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 411 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 412 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 413 |
... if x == 'UploadReport.txt':
|
| 414 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 415 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 416 |
... for line in contents:
|
| 417 |
... dt,amnt = line.split(" | ")
|
| 418 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 419 |
... if
|
| 420 |
>>> preDate = '20120101'
|
| 421 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 422 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 423 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 424 |
... if x == 'UploadReport.txt':
|
| 425 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 426 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 427 |
... for line in contents:
|
| 428 |
... dt,amnt = line.split(" | ")
|
| 429 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:00', '%Y%m%d %H:%M:%S')))
|
| 430 |
... if preDate = dt:
|
| 431 |
Traceback ( File "<interactive input>", line 10
|
| 432 |
if preDate = dt:
|
| 433 |
^
|
| 434 |
SyntaxError: invalid syntax
|
| 435 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 436 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 437 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 438 |
... if x == 'UploadReport.txt':
|
| 439 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 440 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 441 |
... for line in contents:
|
| 442 |
... dt,amnt = line.split(" | ")
|
| 443 |
... if preDate == dt:
|
| 444 |
... count = count +1
|
| 445 |
...
|
| 446 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 447 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 448 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 449 |
... if x == 'UploadReport.txt':
|
| 450 |
... contents = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x))
|
| 451 |
... outputFile = open(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),'w')
|
| 452 |
... for line in contents:
|
| 453 |
... dt,amnt = line.split(" | ")
|
| 454 |
... if preDate == dt:
|
| 455 |
... count = count +1
|
| 456 |
... else: count = 0
|
| 457 |
... preDate = dt
|
| 458 |
... epoch = int(time.mktime(time.strptime(dt+' 12:00:%0*d'%(2,count), '%Y%m%d %H:%M:%S')))
|
| 459 |
... outputFile.write(str(epoch) + " | " + dt + " | " +amnt)
|
| 460 |
... outputFile.close()
|
| 461 |
...
|
| 462 |
>>> for i in os.listdir(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases"):
|
| 463 |
... if os.path.isdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 464 |
... for x in os.listdir(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i)):
|
| 465 |
... if x == 'UploadReport.txt':
|
| 466 |
... os.rename(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x),os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport_OLD.txt'))
|
| 467 |
... os.rename(os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),'UploadReport2.txt'),os.path.join(os.path.join(r"c:\documents and settings\eborges\my documents\my dropbox\Documents\cases",i),x)) |