I have some data that looks something like this
s = "string,string,string;otherstring,otherstring,otherstring"
I want to first split it by the '; ' I used s.split('; ') so I then have
s = ["string, string, string", "otherstring, otherstring, otherstring"]
Then I want to split it again this time by the ', '.
I have tried a few different things that have not worked. How can I solve this?
First I started with
s = "string,string,string;otherstring,otherstring,otherstring"
s.split('; ')
for i in range(len(s)):
s[i].split(', ')
But that didn't work so I then tried
s = "string,string,string;otherstring,otherstring,otherstring"
[i.split('; ') for i in s.split(', ')]
And that also didn't work.
I'm assuming there is a solution using re.split() but I didn't find anything in my 5 minute google search