Spaces:
Running
Running
File size: 469 Bytes
68a9b68 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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
|