Where to hold common strftime strings like (“%d/%m/%Y”)
问题 In my app I find myself using stftime a lot, and mostly with 2 strings formats - ("%d/%m/%Y") and ("%H:%M") Instead of writing the string each time, I want to store those strings in some global var or something, so I can define the format strings in just one place in my app. What is the pythonic way of doing that? Should I use a global dict, a class, a function, or maybe something else? Maybe like this? class TimeFormats(): def __init__(self): self.date = "%d/%m/%Y" self.time = "%H:%M" Or