months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
print months[2].decode("utf-8")
Printing month[2] fails with
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1-2: invalid data
help to get rid of this!
Did you add an encoding in the begining of your source file ?
# -*- coding: utf-8 -*-
Are you sure you are working in UTF8?
Nevertheless, I would recommend to define
months = [u"Januar", u"Februar", u"März", u"April", u"Mai", u"Juni",
u"Juli", u"August", u"September", u"Oktober", u"November", u"Dezember"]
print months[2]
and if you do some stuff basing on bytes, you encode()
the data into the charset you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With