I’d do it this way:
result = []
reader = ['sdsd-sdds', 'asaad', 'deded - wdswd', '123' ]
str_1 = 'deded -'
for x in reader:
if str_1 in x:
result.append(reader[reader.index(x) + 1])
print(result)
If you want to stop after finding the first one you should use a break after finding a value:
result = []
reader = ['deded - wdswd', 'asaad', 'deded - wdswd', '123' ]
str_1 = 'deded -'
for x in reader:
if str_1 in x:
result.append(reader[reader.index(x) + 1])
break
print(result)
3
solved Python: How find the index in list by its part?