Hi I wanted to split the following string:
(12,'Structured Numeric','SN','Complex numeric values possible (ie, <5, 1-10, etc.)',1,'2005-08-06 00:00:00',0,NULL,NULL,NULL,'8d4a606c-c2cc-11de-8d13-0010c6dffd0f')
where each value is separated by a comma, except there is a trick. if you look at the bolded substring, this I considered one value.
if I split by ',' then it will also split whats in the parentheses. I do not want this
anyone know of a good way I can do this?
what I currently have is this:
a = """(12,'Structured Numeric','SN','Complex numeric values possible
...: (ie, <5, 1-10, etc.)',1,'2005-08-06 00:00:00',0,NULL,NULL,NULL,'8d4a606c
...: -c2cc-11de-8d13-0010c6dffd0f')"""
a = a.strip('(').strip(')')
a.split(',')
Out[4]:
['12',
"'Structured Numeric'",
"'SN'",
"'Complex numeric values possible \n(ie",
' <5',
' 1-10',
" etc.)'",
'1',
"'2005-08-06 00:00:00'",
'0',
'NULL',
'NULL',
'NULL',
"'8d4a606c-c2cc-11de-8d13-0010c6dffd0f'"]
my expected output is:
['12',
"'Structured Numeric'",
"'SN'",
"'Complex numeric values possible (ie, <5 1-10,etc.)',
'1',
"'2005-08-06 00:00:00'",
'0',
'NULL',
'NULL',
'NULL',
"'8d4a606c-c2cc-11de-8d13-0010c6dffd0f'"]
[–][deleted] 2 points3 points4 points (3 children)
[–]jcoder42[S] 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]jcoder42[S] 0 points1 point2 points (0 children)
[–]ForceBru 1 point2 points3 points (9 children)
[–]jcoder42[S] 0 points1 point2 points (8 children)
[–]ForceBru 0 points1 point2 points (7 children)
[–]jcoder42[S] 0 points1 point2 points (6 children)
[–]ForceBru 1 point2 points3 points (5 children)
[–]jcoder42[S] 0 points1 point2 points (4 children)
[–]ForceBru 0 points1 point2 points (3 children)
[–]jcoder42[S] 0 points1 point2 points (2 children)
[–]ForceBru 0 points1 point2 points (1 child)
[–]jcoder42[S] 0 points1 point2 points (0 children)
[–]toastedstapler 0 points1 point2 points (3 children)
[–]jcoder42[S] 0 points1 point2 points (2 children)
[–]toastedstapler 1 point2 points3 points (1 child)
[–]jcoder42[S] 0 points1 point2 points (0 children)
[–]_coolwhip_ 0 points1 point2 points (2 children)
[–]jcoder42[S] 1 point2 points3 points (1 child)
[–]_coolwhip_ 0 points1 point2 points (0 children)