When I extract a date from a PR and printed it as below
updated = pull_request.updated_at
print(f"Updated At: {updated}")
It printed well
Updated At: 2024-05-09 00:45:14+00:00
However if I put in an array (I have some other element in the array, but for simplicity purpose, I just show I have the date)
updated = pull_request.updated_at
pull_requests.append([updated])
for pull_request in pull_requests:
print(pull_request)
It printed as below format
[datetime.datetime(2024, 5, 9, 6, 7, 36, tzinfo=datetime.timezone.utc)]
How can I have the date variable in the array, and get the array printed directly i.e. print(pull_request)
, while still having the date string shown concisely, like the 2024-05-09 00:45:14+00:00
format?
p/s: I can do it by extracting the element in the array to print print(pull_request[0])
, but it will be cumbersome given I actually have several element in the array, and I don’t want to extract them out individually.
updated = pull_request.updated_at
pull_requests.append([updated])
for pull_request in pull_requests:
print(pull_request[0])