I have the following code;
oStat=os.stat(oFile)
print(time.strftime('%H:%M:%S', time.localtime(oStat.st_mtime)), oFile)
print(f"{time.localtime(oStat.st_mtime):%H:%M:%S}")
The first print statement works as expected; the f-string gives me:
print(f"{time.localtime(oStat.st_mtime):%H:%M:%S}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported format string passed to time.struct_time.__format__
Why is this in error and how can I fix it?
I’ve tried various combinations but none work.
1