Skip to content

Commit 21032c8

Browse files
authored
Merge pull request #328 from JamesParrott/pyshp-3.0.0-alpha
Switch date field "{}".format()s for f-strings
2 parents 13ba0b0 + cecb3c1 commit 21032c8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

shapefile.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,11 +2613,9 @@ def __dbfRecord(self, record):
26132613
elif fieldType == "D":
26142614
# date: 8 bytes - date stored as a string in the format YYYYMMDD.
26152615
if isinstance(value, date):
2616-
value = "{:04d}{:02d}{:02d}".format(
2617-
value.year, value.month, value.day
2618-
)
2616+
value = f"{value.year:04d}{value.month:02d}{value.day:02d}"
26192617
elif isinstance(value, list) and len(value) == 3:
2620-
value = "{:04d}{:02d}{:02d}".format(*value)
2618+
value = f"{value[0]:04d}{value[1]:02d}{value[2]:02d}"
26212619
elif value in MISSING:
26222620
value = b"0" * 8 # QGIS NULL for date type
26232621
elif is_string(value) and len(value) == 8:

0 commit comments

Comments
 (0)