Use shlex.split
:
s = 'format db "this is string a", 0, 0Ah'
import shlex
shlex.split(s)
Out[18]: ['format', 'db', 'this is string a,', '0,', '0Ah']
Your grammar is a little wonky with the trailing commas, but you can pretty safely rstrip
that out:
[x.rstrip(',') for x in shlex.split(s)]
Out[20]: ['format', 'db', 'this is string a', '0', '0Ah']