I am getting an error as list object has no attribute 'join'

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?

5

2 Answers

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) 
1

.join should be applied on strings. You are trying that on list. Basically, a in the for loop is a list.

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobGxwY2eDcYOOomSapV2csrXAyKeeZpmeYrKzvs6rZJqrXaG2tMCMqJmjnZOpeqmt0malqGWRqcGztcGuq55lmqS2rw%3D%3D