Specifically I am having problems with using %-d
and %-m
on Windows.
The error I am getting is simple
output_dict.update({"DOB1": f"{dob.strftime('%-m/%-d/%Y') if not dob is None else 'UniqueID' + str(row)}"})
ValueError: Invalid format string
My format string looks like this:
dob.strftime('%-m/%-d/%Y')
I am fairly certain that this is because I am windows but I was wondering if there was a platform independent way of fixing this problem or if I am doing something else wrong which is causing this error.
I saw something about %e
being used for the month in windows strftime
but it replaces the 0 with a space instead but this is undesirable. I am trying to get these exact outputs (I use a similar format string later) 1/1/2000
and January 1 2000
.
I would prefer not to use a solution like {dob.year}
ect because I already have a format string that this is being placed in.
I would appreciate any ideas surrounding best practices and how I can implement a solution to this. Thank you.