example, I have a list called attendances
that contain multiple data like:
[ <Attendance>: 11804 : 2018-07-18 12:22:55, <Attendance>: 11804 : 2018-07-18 12:23:04, <Attendance>: 2 : 2018-07-25 16:17:18, <Attendance>: 2 : 2018-07-25 16:17:20, <Attendance>: 2 : 2018-07-25 16:17:23, <Attendance>: 2 : 2018-07-25 16:27:52]
when I need to print it. I do simply:
for data in attendances:
print 'User ID : {}'.format(data.user_id)
print 'Timestamp : {}'.format(data.timestamp)
result will be:
User ID : 11804
Timestamp : 2018-07-18 12:22:55
User ID : 11804
Timestamp : 2018-07-18 12:23:04
User ID : 2
Timestamp : 2018-07-25 16:17:18
User ID : 2
Timestamp : 2018-07-25 16:17:20
User ID : 2
Timestamp : 2018-07-25 16:17:23
User ID : 2
Timestamp : 2018-07-25 16:27:52
but that not what I need, since its print all the data. I need to only show only one and first data every User ID
.
like this :
User ID : 11804
Timestamp : 2018-07-18 12:22:55
User ID : 2
Timestamp : 2018-07-25 16:17:18
any have idea what should I do?...