Created
July 16, 2018 05:44
-
-
Save mohitkh7/9be513bdaf94bf54e348532a978ff169 to your computer and use it in GitHub Desktop.
Python codefile to save file with name as timestamp of accuracy upto millisecond
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
# Python code to save a file with timestamp of accuracy upto millisecond | |
from datetime import datetime as dt | |
current_time = dt.now() # current system time e.g. 2018-07-16 16:34:43.050328 | |
current_time_as_str = str(current_time) | |
filename = current_time_as_str + ".txt" | |
file = open(filename, "w+") # Create a empty text file with timestamp name | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment