leo-bourrel's picture
!feat: Import new sorbobot version
68a9b68
raw
history blame
No virus
469 Bytes
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