This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Can someone help me understand why these equivalent strings are returning as false when I try to check if they are??
Post Body
Here is the code I am working with
def expiryChecker():
today = datetime.date.today()
count = datetime.timedelta(30)
expiryDate = today count
#if the file does not exist, create it and input the expiry date as string
if os.path.exists('/Users/justinfrancisco/Desktop/pythonPractice/accountExpiry.txt') == False:
file = open("accountExpiry.txt","w ")
file.write(str(expiryDate) "\n")
file.close()
print('file created')
#open the file again and grab the line of text. close the file.
file = open("accountExpiry.txt","r")
expiryStr = file.readline()
file.close()
today = '2017-11-21'
#expiryStr = '2017-11-21'
print(today)
print(expiryStr)
if str(today) == str(expiryStr):
return True
else:
return False
I am trying to determine if 30 days have passed since an account is initialized. When it gets down to the end and I am trying to check if the stored expiry date is the same as todays date it returns as false even when I force the strings to be the same. Can someone help me with this problem? Thank you so much
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,125
Link Karma
3,675
Comment Karma
2,404
Profile updated: 3 days ago
Posts updated: 8 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...