O'Reilly logo

Python 3 Text Processing with NLTK 3 Cookbook by Jacob Perkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Timezone lookup and conversion

Most datetime objects returned from the dateutil parser are naïve, meaning they don't have an explicit tzinfo, which specifies the timezone and UTC offset. In the previous recipe, only one of the examples had a tzinfo, and that's because it's in the standard ISO format for UTC datetime strings. UTC is the coordinated universal time, and is basically the same as GMT. ISO is the International Standards Organization, which among other things, specifies standard datetime formatting.

Python datetime objects can either be naïve or aware. If a datetime object has a tzinfo, then it is aware. Otherwise, the datetime is naïve. To make a naïve datetime object timezone aware, you must give it an explicit tzinfo. However, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required