First off, I am very new to all of python. I am now trying to figure out how to replace a time string in a certain column (csv) when that time is greater than the current time.
The script I am building from is relying on petl, so that is what i am using. First, the source csv is opened with petl as table1. It contains multiple columns, one of which is " End time". In this column I would like to replace that time with @time? (for HTML formatting later), only if it is greater than the current time.
the time has the format like "12:15". However, I do not see any change when running the line with >, yet with < all values in the column change.
The line I am struggling with:
current=time.localtime()
table2= petl.convert(table1, ' End time', lambda v, row: '@'+v+'?' if time.strptime(v, '%H:%M') > current else v, pass_row=True)
I would also like to know how I can print or see what time.strptime is using as values, is this possible?
Any ideas are highly appreciated!