I would like to compare the value of a key from a JSON file to see if I have recorded data from todays date by seeing if the current date exists in the file so i don't record data from the same day. But this method seems to return False even if the date is present.
def removeJsonDupes(JSONcompleteFilePath, date):
with open(JSONcompleteFilePath, "r") as file:
dictionary = json.load(file)
if dictionary.get("date") is str(date):
dateRecorded = True
print(date, "is in the dict")
else:
dateRecorded = False
print(date, "is not in the dict")
return dateRecorded
JSON content:
{
"prices": [
{
"date": "07/12/21",
"prices": [
"2.49",
"1.61"
]
}
]
}