Skip to content

Commit 9410a21

Browse files
committed
refactor longline to use format()
1 parent c8d4a04 commit 9410a21

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/timestamp_filename/code.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@
4747
try:
4848
pycam.display_message("snap", color=0x00DD00)
4949
# pylint: disable=line-too-long
50-
timestamp = f"img_{time.localtime().tm_year}-{time.localtime().tm_mon}-{time.localtime().tm_mday}_{time.localtime().tm_hour:02}-{time.localtime().tm_min:02}-{time.localtime().tm_sec:02}_"
50+
timestamp = "img_{}-{}-{}_{:02}-{:02}-{:02}_".format(
51+
time.localtime().tm_year,
52+
time.localtime().tm_mon,
53+
time.localtime().tm_mday,
54+
time.localtime().tm_hour,
55+
time.localtime().tm_min,
56+
time.localtime().tm_sec,
57+
)
5158
pycam.capture_jpeg(filename_prefix=timestamp)
5259
pycam.live_preview_mode()
5360
except TypeError as exception:

0 commit comments

Comments
 (0)