Last active
March 11, 2019 18:48
-
-
Save Miladiouss/83dc2ac97909817da9bc0dd914d73c6b to your computer and use it in GitHub Desktop.
Print a stamp in Python with date, time, device name, and user name (e.g. 'Fri Mar 08 2019 at 00:41:02 on myPC by User')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
timeFormat = '%a %b %d %Y at %H:%M:%S' | |
import socket | |
deviceName = socket.gethostname() | |
import getpass | |
userName = getpass.getuser() | |
t1 = datetime.now() | |
print(t1.strftime(timeFormat) + ' on ' + deviceName + ' by ' + userName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment