Re: Thanks for your review

dn via Tutor <[email protected]> Tue, 26 Mar 2024 18:18:35 +1300
Newsgroups gmane.comp.python.tutor
Organization DWM
Message-ID <[email protected]>
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
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor