I run my Python scripts with python -m unittest discover
command. I'd like to passing current time yyyymmddhhmmss
as parameter into execution command.
How can do that?
I run my Python scripts with python -m unittest discover
command. I'd like to passing current time yyyymmddhhmmss
as parameter into execution command.
How can do that?
If you want to sample the current time on the system running the puthon code, you can use datetime.datetime.now()
(local time) or datetime.datetime.utcnow()
(UTC).
Then you can format as string using .strftime("%Y%m%d%H%M%S")
.