DragonBowl

Make a program that ,take's time logs in python

Feb 21st, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | Source Code | 0 0
  1. #Make a program that ,take's time logs in python
  2.  
  3. #first start of by making a .txt file with a name , for example , example.txt , then here is the source code
  4.  
  5. def logs():
  6.     import datetime
  7.     current_time = datetime.datetime.now()
  8.     current_time = str(current_time)
  9.     logs = open('example.txt', 'a')
  10.     # here you can write your message
  11.     logs.write('\n----------------------------')
  12.     logs.write('\n ran at ')
  13.     # Dont change this line below
  14.     logs.write(current_time)
  15.     logs.write('\n----------------------------\n')
  16.  
  17. logs()
  18.  
Advertisement
Add Comment
Please, Sign In to add comment