I want to identify if a string contains a date formatted as MM/DD/YY. It can be any date, as long as its in that format. Not sure how I would denote this.
for line in f:
if date in line:
print(line)
Data:
>Unneeded text<
Account: 5
03/29/18 7,885,216.93- 208,557,351.68 200,672,134.75 2.18 12,151.81
03/30/18 7,885,216.93- 208,557,351.68 200,672,134.75 2.18 12,151.81
03/31/18 7,885,216.93- 208,557,351.68 200,672,134.75 2.18 12,151.81
04/01/18 7,885,216.93- 208,557,351.68 200,672,134.75 2.18 12,151.81
04/02/18 10,487,227.15 202,979,865.76 213,467,092.91 2.17 12,867.30
04/03/18 26,149,970.46- 209,222,696.72 183,072,726.26 2.18 11,086.08
04/04/18 13,606,232.52- 217,761,977.25 204,155,744.73 2.18 12,362.77
04/05/18 29,929,731.83- 228,565,335.73 198,635,603.90 2.19 12,083.68
04/06/18 32,832,695.61- 235,134,802.88 202,302,107.27 2.19 12,306.70
04/07/18 32,832,695.61- 235,134,802.88 202,302,107.27 2.19 12,306.70
04/08/18 32,832,695.61- 235,134,802.88 202,302,107.27 2.19 12,306.70
04/09/18 31,908,656.83- 232,249,566.41 200,340,909.58 2.19 12,187.38
04/10/18 20,367,782.42- 229,302,450.95 208,934,668.53 2.19 12,710.17
>Unneeded text<
Account: 6
03/29/18 7,885,216.93- 208,557,351.68 200,672,134.75 2.18 12,151.81
This is one account's worth of data. There are approx 30 accounts I need to iterate through. The issue is that each section of data is separated by some text that is not necessary.
My current script grabs the account # along with yesterday's data:
for line in f:
if "ACCOUNT: " + Account in line:
TAccount = Account
for line in f:
if rdate.strftime("%m/%d/%y") in line:
print(line)
I was hoping that there would be a way to just find any string that began with a date formatted as MM/DD/YY