From cecb3c1b24f99e13c99adcb07c6f3d42fd3eb926 Mon Sep 17 00:00:00 2001 From: James Parrott <80779630+JamesParrott@users.noreply.github.com> Date: Wed, 23 Jul 2025 18:48:36 +0100 Subject: [PATCH] Switch date field "{}".format()s for f-strings --- shapefile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/shapefile.py b/shapefile.py index fe48f3e..1f8bbf8 100644 --- a/shapefile.py +++ b/shapefile.py @@ -2613,11 +2613,9 @@ def __dbfRecord(self, record): elif fieldType == "D": # date: 8 bytes - date stored as a string in the format YYYYMMDD. if isinstance(value, date): - value = "{:04d}{:02d}{:02d}".format( - value.year, value.month, value.day - ) + value = f"{value.year:04d}{value.month:02d}{value.day:02d}" elif isinstance(value, list) and len(value) == 3: - value = "{:04d}{:02d}{:02d}".format(*value) + value = f"{value[0]:04d}{value[1]:02d}{value[2]:02d}" elif value in MISSING: value = b"0" * 8 # QGIS NULL for date type elif is_string(value) and len(value) == 8: