Resolved local variable 'str' referenced before assignment
Article Directory
Error report
I have encountered this pit in my work before, and record the problem and solution. It may not be applicable to all situations, but it can be used for your reference.
The problem description is as follows:
local variable ‘str’ referenced before assignment
local variable 'str' was referenced before assignment
Solution
You need to add code in front of it from builtins import str
PS
If you have any questions, just leave a message in the comment area