Answer the question
In order to leave comments, you need to log in
How to rename the resulting file in Python without changing its extension?
I receive an email, and if it has an attachment, I receive that as well. Then I send this letter along with an attachment to telegram. But the problem is that if the file name in the attachment is in Russian, then I get an error
TypeError: decoding to str: need a bytes-like object, Header found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Answer the question
In order to leave comments, you need to log in
I read the "Unicode HOWTO" section of the documentation, I had no problems with Cyrillic.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question