# topics = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] # num_groups = 4 # # print([topics[i::num_groups] for i in range(num_groups)]) v = "{{next_cursor}}" if isinstance(v, str) and v.startswith("{{") and v.endswith("}}"): key = v.strip("{}") print(key)