Posts

Showing posts from April, 2018

Creating random time stamps and saving it in a file

from random import randrange import datetime import numpy as np def random_date(start,l):    current = start    while l >= 0:       curr = current + datetime.timedelta(minutes=randrange(60))       yield curr       l-=1 startDate = datetime.datetime(2013, 9, 20,13,00) f = open('filepath name\filename.txt','w') for x in random_date(startDate,500):     f.write((x.strftime(""%d/%m/%y"","" %H:%M,"))) f.close()