Spaces:
Sleeping
Sleeping
import re | |
def str_to_list(str_input: str) -> list[str]: | |
if isinstance(str_input, list): | |
return str_input | |
splits = re.split(r"', '|\", \"|', \"|\", '", str_input) | |
splits = [ | |
split.removeprefix("[") | |
.removesuffix("]") | |
.removeprefix("(") | |
.removesuffix(")") | |
.removeprefix("'") | |
.removesuffix("'") | |
.removeprefix('"') | |
.removesuffix('"') | |
for split in splits | |
] | |
return splits | |