I am using Python v2.x on Windows 8 bit-64.
The question is, I failed to generate a txt
file named as real time.
Please see the code I have now:
import sys
import datetime
def write():
# try:
currentTime = str(datetime.datetime.now())
print currentTime #output: 2016-02-16 16:25:02.992000
file = open(("c:\\", currentTime, ".txt"),'a') # Problem happens here
print >>file, "test"
file.close()
I tried different ways to modify the line file = open(("c:\....)) but failed to create a text file like 2016-02-16 16:25:02.992000.txt
Any advice please?