Constant error in using strptime

0

Expensive,

I've always worked on strptime without major problems, but an error began to appear that I did not find in any citation:

from datetime import datetime
a = "20160228"
date = datetime.strptime(a, "%Y%m%d")

This is just the example and error that appears:

Traceback (most recent call last):
  File "/home/bruno/PycharmProjects/Shiny/date.py", line 3, in <module>
    date = datetime.strptime(a, '%Y%m%d')
  File "/usr/lib/python2.7/_strptime.py", line 274, in <module>
    _TimeRE_cache = TimeRE()
  File "/usr/lib/python2.7/_strptime.py", line 192, in __init__
    self.locale_time = LocaleTime()
  File "/usr/lib/python2.7/_strptime.py", line 70, in __init__
    self.lang = _getlang()
  File "/usr/lib/python2.7/_strptime.py", line 29, in _getlang
    return locale.getlocale(locale.LC_TIME)
AttributeError: 'module' object has no attribute 'getlocale'

Thanks for the help.

    
asked by anonymous 08.05.2018 / 21:55

0 answers