I have a very special work to do, here is my input
Period End Date 12/30/ 12/31/ 12/29/ 12/28/ 12/31/2007
2011 2010 2009 2008
You can see this is a wrong input file:
- year is on the second line
- but last date is correct
So I want to dig out the correct date: 12/31/2011 12/31/2012 12/31/2009 12/31/2008 12/31/2007
Here is what I am trying to do
input_file = open("input", "r")
for line in input_file:
index = line.find("Period End Date", 0)
if index != -1:
line = line[index+len("Period End Date"):len(line)]
temp_line = " ".join(line.split())
temp_line.split(" ")
year_line= input_file.next()
#remove space, split,append on temp_line[i]
But it doesn't work:
temp_line.split(" ")
returns ['1','2','/', ...] not ['12/31/', '12/30', ...]
What's wrong with that?