Advertisement
surya_adi

RandomTimeGenerator.py

Jun 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. import random
  2. import datetime
  3.  
  4. q = datetime.date(2018,6,11)
  5. #w = datetime.date.today()
  6. w = datetime.date(2018,6,25)
  7. e = (w-q)
  8. title='F:/rand-num-{}.txt'.format(w)
  9.  
  10. with open(title,mode='w',encoding='utf-8') as p:
  11.     p.write("tanggal \t masuk \t keluar\n")
  12.     for r in range(e.days+1):
  13.         t = q+datetime.timedelta(days=r)
  14.         a=random.randint(7,8)
  15.         if a == 7:
  16.             s = random.randint(50,59)
  17.         else:
  18.             s = random.randint(0,15)
  19.         d,f=random.randint(16,17),random.randint(0,59) 
  20.         p.write("{} \t {}:{} \t {}:{}\n".format(t,a,s,d,f))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement