Write a function to Filter String with substring at specific position
Topic: Write a function to Filter String with substring at specific position
Solution
def f_substring(): test_list = ['program ', 'to', 'filter', 'for', 'substring'] print("The original list is : " + str(test_list)) sub_str = 'geeks' i, j = 0, 5 res = list(filter(lambda ele: ele[i: j] == sub_str, test_list)) print("Filtered list : " + str(res))
List all Python Programs