The decode method is the method used to convert byte strings.Therefore, the string object does not have a decode method.
This error points out that.Use the encode method to convert a string object to a byte string.
However, encoding is specified at the time of file opening, so this process may not be necessary.
Perhaps you are trying to run a program written in python2 on python3 (because the decode of str is not in python3).
I would like to move the TextGenerator as shown below.
If so, I think this page will be helpful.
The link above automatically converts python2 code to python3 using
2to3 and then manually corrects the questions you have.
I think it would be easier to get answers if you write not only the problem but also the prerequisites.
© 2022 OneMinuteCode. All rights reserved.