type(object) prints <class 'list'> but creates an error when I try doing normal list operations with it. E.g len and insert | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

type(object) prints <class 'list'> but creates an error when I try doing normal list operations with it. E.g len and insert

AttributeError: 'Nonetype' object has no attribute insert

10th Apr 2021, 7:28 AM
Charles Itibi
Charles Itibi - avatar
3 Answers
+ 1
Share your code so we can see the issue.
10th Apr 2021, 9:36 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
If you're not able or willing to share a MWE of your code then the only other thing I can say that may help you is that obviously your variable is equal to None when you're performing whatever operation it is that results in the error. You may want to try and walk through your code with a debugger to watch the values and see if you can find the issue(s) yourself.
10th Apr 2021, 7:20 PM
ChaoticDawg
ChaoticDawg - avatar
0
It involves working with a file so I can't
10th Apr 2021, 1:19 PM
Charles Itibi
Charles Itibi - avatar