I have some date in a .ini "yyyymmdd" format.
my .ini files details:
[global]
date_with_interval = 20210311:3, 20200228:4
In this above variable, I have two values with colon-separated 1st one is the date and 2nd interval so based on the interval value in need to fetch a sequence of date like
#I need the output in this format
output = [[20210311,20210312,20210312],[20200228,20200229,20200301,20200302]]
I have tried in this way but miss some points.
import configparser
config_file= "file1.ini"
con.read(config_file)
def read(name):
return con.get('global', name)
valid_date = []
data_date = read("date_with_interval")
date_info = data_date.split(",")
for date in date_info:
date_format,interval = date.split(":")
print("Date is:",date_format)
print("Interval",interval)
year,month,dd = date_format[0:4],date_format[4:6],date_format[6:8]
print("year",year)
print("month",month)
print("date", dd)