Aug-07-2020, 06:04 PM
Hallo everybody,
I want to have files in the format "2020-08-07_19-57-55.txt" - it´s for measuring purpopses and for having a unique filename. I found:
The above line gives me an errrormessage - how do I pass the variable "filename" to the "file = open()" command. I tried but didn´t find the answer - I´m new to python. Could use a little help!!!
I want to have files in the format "2020-08-07_19-57-55.txt" - it´s for measuring purpopses and for having a unique filename. I found:
import datetime filename = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") file = open("/media/pi/Raspberry-Stick/filename.txt","w")
The above line gives me an errrormessage - how do I pass the variable "filename" to the "file = open()" command. I tried but didn´t find the answer - I´m new to python. Could use a little help!!!