3 ms·
The timezone thing in Python that bit me was when I needed to parse a time string. Googling told me Python had strptime and it would do what I wanted. So I foun
by tzs 3y ago
The timezone thing in Python that bit me was when I needed to parse a time string. Googling told me Python had strptime and it would do what I wanted. So I found it in the Python docs and used it.
What I failed to notice was that Python has two strptime functions, one in time and one in datetime, and they are not the same. I was losing timezone information that was in my time strings, and when I wrote a test program to just test timezone parsing I happened to pick the other strptime and everything worked fine, which left me quite confused.