[issue35407] Datetime function with selenium

2018-12-04 Thread Sameer Joshi


New submission from Sameer Joshi :

I have defined 2 variables , 1 for Friday and other for rest of weekdays. 
However when I match these two with the website date(which is 'today - 3' for 
Monday and 'today -1' )it shows the error as variable not defined. Below is 
code for the same.

import datetime


d = datetime.date.today()

if d.weekday() == 0:
tdelta = datetime.timedelta(days=3)
friday = d - tdelta
print(friday)


elif d.weekday() in range(1,5):
tdelta1 = datetime.timedelta(days=1)
prev_day = d - tdelta1
print(prev_day)

data_date = new.date()  # data_date is the date fetched from website
if data_date == friday:
print("Data as on", friday, "for Race Horses")
elif data_date == prev_day:
print("Data as on", prev_day, "for Race Horses")
else:
print("Data update required.")

--
messages: 331038
nosy: jsameer23
priority: normal
severity: normal
status: open
title: Datetime function with selenium
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue35407>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35407] Datetime function with selenium

2018-12-04 Thread Sameer Joshi


Sameer Joshi  added the comment:

I have defined 2 variables , 1 for Friday and other for rest of weekdays. 
However when I match these two with the website date(which is 'today - 3' for 
Monday and 'today -1' )it shows the error as variable not defined. Below is 
code for the same.

import datetime


d = datetime.date.today()

if d.weekday() == 0:
tdelta = datetime.timedelta(days=3)
friday = d - tdelta
print(friday)


elif d.weekday() in range(1,5):
tdelta1 = datetime.timedelta(days=1)
prev_day = d - tdelta1
print(prev_day)

data_date = new.date()  # data_date is the date fetched from website
if data_date == friday:
print("Data as on", friday, "for page")
elif data_date == prev_day:
print("Data as on", prev_day, "for page")
else:
print("Data update required.")

--
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue35407>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com