Evernote scraper 6
Some minor changes I’ve made was adding extra conditional with the if statement
if len(values_to_row) > 3 and regex_dates.search(values_to_row[0]):
lifts_writer.writerow(values_to_row)
print(values_to_row)
values_to_row.clear()
else:
Now the if statement reads the list if its over 3 values and also checks to see if the first value in the row/list is a date. This what the csv file looks below.
As we can we captured most the beginning days in the list. It stops as the next value not a date. So the next stage now is to develop the else or elif statement to deal with values that are not dates. And write them into a row in correct order.
Right now I’ve found a less than optional solution was to do a regex find on the value which is stopping the loop.
if re.search('---', values):
lifts_writer.writerow(values_to_row)
print(values_to_row)
values_to_row.clear()
Even though this does not place the value in the previous row it allows the loop to continue. Added an or conditional to allow for more values to be added into the loop
if re.search('---', values) or re.search('pra', values):
lifts_writer.writerow(values_to_row)
print(values_to_row)
values_to_row.clear()