[Tutor] Thanks for your review
dn
PythonList at DancesWithMice.info
Tue Mar 26 01:18:35 EDT 2024
On 26/03/24 08:59, Jonathan Wilson via Tutor wrote:
> Hello. I am getting an error in the beginning of my python script and it is referring to this line:
>
> newDBFileName = today.strftime(.format(today.month, today.day)) + ' '
> ^
> SyntaxError: invalid syntax
>
> Can someone tell me what the invalid syntax is here for this line? Appreciate any help you can give. (new python coder)
>
> The arrow is pointing to the .ahead of the format.
Have you copied this from somewhere, or is it your own code?
The error.message is telling you that the dot cannot come after the
left-parenthesis.
However, more importantly, in tutorials the word "format" is usually a
place-holder for codes which determine how you want the datetime object
to be formatted. Sorry if this notation has caused confusion.
Don't ask me where the dot came in.
The contents of the inner parenthesis don't look like formatting
instructions.
Perhaps you could describe the expected output in English?
Web.Refs:
The docs:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
A useful tutorial: https://pynative.com/python-datetime-format-strftime/
--
Regards,
=dn
More information about the Tutor
mailing list