Timeline for Python Display Streamlining
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 2, 2020 at 19:10 | comment | added | Graipher |
@RootTwo: Yeah, and I even read somewhere recently that datetime just implements __format__ , I just never connected the dots and realized that this means I can get rid of that strfmt ...
|
|
Feb 2, 2020 at 18:36 | comment | added | RootTwo |
@Graipher, f-strings call the __format__(self, format_spec) method. So it works with anything that defines that method. User defined classes can define their own format_spec.
|
|
Feb 2, 2020 at 16:32 | comment | added | Graipher |
Didn't know the format specifier gets passed along to the datetime object like this. This is shorter (and more readable) than writing curr_time.strftime("%a, %b %d, %Y") , nice!
|
|
Feb 2, 2020 at 12:54 | comment | added | Megastrik3 | Sweet! Thank you for the suggestion! I will definitely look into it 👍 | |
Feb 1, 2020 at 6:41 | history | answered | RootTwo | CC BY-SA 4.0 |