view raw
Vishal Mahajan Vishal Mahajan - 8 months ago 39
Python Question

Python code to run for next 100 days from today

I want to run below line of code for 200 days from today.
Suppose today is 1st days so my code is-

line = linecache.getline("lines1.txt",1)

Suppose today is 2nd days so my code is-

line = linecache.getline("lines1.txt",2)

Suppose today is 3rd days so my code becomes-

line = linecache.getline("lines1.txt",3)

I want above 1,2,3,4,5......200 to be calculated everyday. I don't want a loop to run for 200 days.

I just need to get 1,2,3,4,5......200 count from python Date system or any other counting system.


set a marker date then calculated difference between today dan marker date

(datetime.datetime(2016,9,2) - datetime.datetime(2016,9,1) ).days