I have a list of lists in the format:
list = [["5:2", "1:0"],["3:4", "5:2"],["1:2", "1:1"],["4:5", "1:0"]]
I would like to check if the first index of each internal lists contains a string. I have tried to use the following:
(next(i for i,j in enumerate(list) if (a) in j))
However, this checks every string in the list of lists, instead of a specific index.
How could I modify this code to only check index 0 of the internal list?
Thanks
Two possible solutions:
ans = [i for i, j in enumerate(list) if type(j[0]) == str]
ans = [True if type(i[0]) == str else False for i in list]