Keep getting this split error, when trying to split up my list Word by Word, line by line.
I got a file which contains links, +20000 links. These links is in a list call
First thing - as Martijn Pieters said, your indentation is off. Its hard to guess exactly what you mean, please fix it. But:
paths = [line.strip().split('\t') for line in tsv]
line.split('\t') already returns a list. You put that list into path
so path
is a list of lists. You iterate over that list of lists here:
for line in newPath:
links.append(line[3:4])
so links will also be a list of lists. And finally:
for i in links:
newList.append(i.split(';'))
you try to call split
for i
- which is a list. split is a member function of str
and does not exist for lists - hence your error.