datestring = datetime.datetime.now().strftime("%Y-%m-%d") print(datestring) os.mkdir(datestring)
(now i need to open this folder and create a csv file name as attendance)
f = open(datestring,'Attendance.csv', 'r ')
writer = csv.writer(f)
CodePudding user response:
The simplest way is to use relative path to file. Also, I think you should use with
statement while operating with files.
datestring = datetime.datetime.now().strftime("%Y-%m-%d")
print(datestring)
os.mkdir(datestring)
with open(datestring '/Attendance.csv', 'r ') as f:
writer = csv.writer(f)
# ... your further code ...