[Tutor] Need help in understanding why I'm now getting a SyntaxError on a previously working code

Alan Gauld alan.gauld at yahoo.co.uk
Mon Jun 26 08:07:15 EDT 2023


On 26/06/2023 05:58, Joe Huang wrote:

>    File "wkg_API_points.py", line 33
>      filename = f"{locname}_{latitude}_{longitude}_{start}-{end}_CERES.txt"
>                                                         ^
> SyntaxError: invalid syntax
> 
> My suspicion is that I might be using an outdated version,

That would explain it since format strings are a quite recent
introduction. But there are many, many, minor changes in syntax etc
between python 3 and 2. Also Python 2 is now officially obsolete
and unsupported.

So the first step is definitely to upgrade to, say, v3.10 or higher

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos





More information about the Tutor mailing list