0

I have a list of dates in a .csv and I would like to fetch a date nearest to today's date. How do I achieve that? Issue is in the list, Sat, Sun and holidays are omitted. Can anyone please help?

enter image description here

I don't know how to read data from csv and get the previous date.

Whity
  • 1
  • 2

1 Answers1

0

Since .csv is a text file, you can open it with notepad.exe. Then just do some text parsing. About csv file format: https://en.wikipedia.org/wiki/Comma-separated_values.

This code from How to extract numbers from a string in Python? should work to extract numbers form the string.

[int(s) for s in re.findall(r'\b\d+\b', "he33llo 42 I'm a 32 string 30")]
result: [42, 32, 30]
Le Young
  • 37
  • 4