samedi 16 janvier 2021

Generate list of random datetimes in ISO8601 format in Python

I want to generate a list of length n with random datetime strings in Python within a range.

import datetime
start = datetime.datetime(2019,1,1,0,0,0).astimezone().replace(microsecond=0).isoformat()
end = datetime.datetime(2019,12,31,23,59,59).astimezone().replace(microsecond=0).isoformat()

I had asked a similar question before, but I did not use the correct format for datetime.What is the best way to achieve this?




Aucun commentaire:

Enregistrer un commentaire