I have a list:
ueid_list = [['0'],['0','1'],['0','1','2']...]
corefiles(str type): {"core0.log", "core4.log","core3.log","core7.log"}
RNTI(str type):{"0x0000","0x003f",...}
The below code has a loop that iterates over the above three by taking values one after other in the function and prints details accordingly...
My code:
for a in (ueid_list):
for b in (corefiles):
for c in (rnti):
getUeLinesFromcorefiles(b,a,c)
The above getueid function is defined as:
def getUeLinesFromcorefiles(filenames, ueid, rnti)
.
.
.
.
.
This is showing an error:
as attributeerror: 'list' object has no attribute 'join'
How can I deal with this error?
The part “'list' object has no attribute 'replace'” tells us that the list object we are handling does not have the replace attribute. We will raise this error if we try to call the replace() method on a list object. replace() is a string method that replaces a specified string with another specified string.
It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when the "module" does not contain the method you are calling.
The Python "AttributeError: 'list' object has no attribute 'split'" occurs when we call the split() method on a list instead of a string. To solve the error, call split() on a string, e.g. by accessing the list at a specific index or by iterating over the list.
The main question is not relevant, but the title is the error I got.
I mixed up the syntax trying to join a list of strings. I was doing this:
list_of_str.join(' ')
when I should do this:
' '.join(list_of_str)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With