anyone can help with below?
(shlex.split
or re
could work, but no idea why codes below won't work)
s = 'hello, world, a, "b,c", d'
list(csv.reader([s]))[0]
# ['hello', ' world', ' a', ' "b', 'c"', ' d'] - get this
# ['hello', ' world', ' a', 'b,c', ' d'] - i want this
as it marked as duplicated, but found the link can't answer the question, especially below which still some problem for quotation in csv.reader:
s3 = "self, c: hug.types.number, d='hello, world'"
list(csv.reader([s3], skipinitialspace=True))[0]
# ['self', 'c: hug.types.number', "d='hello", "world'"] - get this
# ['self', 'c: hug.types.number', "d='hello, world'"] - i want this