import datetime currentdate = datetime.datetime.now().date() resultmessage = {…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
import datetime
current_date = datetime.datetime.now().date()
result_message = { "Document_Id": { "Message": [] } }
Today_message = [] # Здесь должно быть ваше значение для Today_message
Old_id = [] # Здесь должно быть ваше значение для Old_id
if Today_message != []: for mess in Today_message['Document_Id']: message_date = datetime.datetime.strptime(mess['children'][2]['children'][0]['VALUE'], "%Y-%m-%d").date()
if message_date == current_date:
Old_id.append(mess['children'][2]['children'][0]['VALUE'])
result_message['Document_Id']['Message'].append(mess)
for msg in result_message['Document_Id']['Message']: message_date = datetime.datetime.strptime(msg['children'][2]['children'][0]['VALUE'], "%Y-%m-%d").date() if message_date == current_date: print("Сообщение с сегодняшней датой:", msg)
result_message["Document_Id"]["Message"].append( { "Document_Id": "MaxId", "Message": [{ "MaxId": { "similar": [], "source": "Telegram", "children": { "Public_date": "data_time", "Channel": { "Channel_id": "rChannel", "Channel_name": "channel", "Channel_link": "rChannel", "Channel_subs": "subs" }, "Content": { "message_id": "message_id", "message_Text": "message", "SourseText": "message", "views": "views", "RelSize": "RelSize", "message_photo": "photoLink", "container_photo": "png", "SoursePhoto": "photoLink", "message_video": "videoLink", "container_video": "mp4", "SourseVideo": "videoLink", "difference_time": "difference_time" }, "Tag": { "AllGroup": ["Сегмент"], "Allteg": ["Нет темы", "Отрасль"], "Нет темы": { "id": "0", "idParent": "0", "Type_object": 0 }, "Отрасль": { "id": "2", "idParent": "1", "Type_object": "0" } } } } }] } ) import time import datetime
current_date = datetime.datetime.now().date()
result_message_Today = { "Document_Id": { "Message": [] } }
result_message_Yesterday = { "Document_Id": { "Message": [] } }
for message in result_message["Document_Id"]: dataMessageUnix = int( time.mktime(time.strptime
Sure, I can help you with that!
The first step would be to iterate over the result_message dictionary and check if the message date is equal to the current date. If it is, then we can append the message to the result_message_Today dictionary.
Here's an example of how you could do this:
import time
import datetime
current_date = datetime.datetime.now().date()
result_message_Today = {
"Document_Id": {
"Message": []
}
}
result_message_Yesterday = {
"Document_Id": {
"Message": []
}
}
for message in result_message["Document_Id"]:
dataMessageUnix = int(time.mktime(time.strptime(message["children"][2]["children"][0]["VALUE"], "%Y-%m-%d")))
if dataMessageUnix == current_date:
result_message_Today["Document_Id"]["Message"].append(message)
else:
result_message_Yesterday["Document_Id"]["Message"].append(message)
print(result_message_Today)
print(result_message_Yesterday)
This code will iterate over the result_message dictionary and check the date of each message. If the date is equal to the current date, it will append the message to the result_message_Today dictionary. If the date is not equal to the current date, it will append the message to the result_message_Yesterday dictionary.
I hope this helps! Let me know if you have any questions.