'decode' is not an attribute of the 'str' object. why is this a Python 3 error?
import imaplib
from email.parser import HeaderParser
conn = imaplib.IMAP4_SSL('imap.gmail.com')
conn.login('example@gmail.com', 'password')
conn.select()
conn.search(None, 'ALL')
data = conn.fetch('1', '(BODY[HEADER])')
header_data = data[1][0][1].decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
Python 3 doesn't have decode anymore, am I right? how can I fix this?