I'd like to execute the following command, but I don't know the correct format.How should I fix it?
subprocess.call("date-set="January 1, 2017 01:02:03")
Note:
If you try to do it, you'll see the following for this line:
SyntaxError: invalid syntax
We have determined that it is a formatting error because we cannot execute it with the error
To include "
in the string, write \"
or enclose it with '
.
subprocess.call("date-set=\"January 1, 2017 01:02:03\"")
subprocess.call('date-set="January 1, 2017 01:02:03")
Also, if you specify it in list format, you should not need quotation marks to enclose the date.
subprocess.call(["date", "-set=2017/01/01/02/03")
© 2024 OneMinuteCode. All rights reserved.