 |
ATLAS Offline Software
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
4 """Split the string L at the character DELIM.
5But don't split within groups nested in ([{}]) or in strings.
7>>> split_list1 ('12345', ',')
9>>> split_list1 ('123, [45, 67], (89,[10,11],12), 13', ',')
10['123', '[45, 67]', '(89,[10,11],12)', '13']
11>>> split_list1 ('12, "34,56", 78', ',')
12['12', '"34,56"', '78']
18>>> split_list1 ('12, "34,56", '+sq+'11,12'+sq+', 78', ',')
19['12', '"34,56"', "'11,12'", '78']
20>>> split_list1 ('12, "34,56'+bs+dq+',99", '+sq+'11,12'+sq+', 78', ',')
21['12', '"34,56\\\\",99"', "'11,12'", '78']
22>>> split_list1 ('12, "34,56'+bs+bs+dq+',99, '+sq+'11,12'+sq+', 78', ',')
23['12', '"34,56\\\\\\\\"', '99', "'11,12'", '78']
33 if c == delim
and nest == 0:
43 while j < sz
and not (l[j] == c
and not esc):
52 while i < sz
and l[i] ==
' ':
58 """L is a string representation of a list. Split it at commas.
59But don't split within groups nested in ([{}]) or in strings.
61>>> split_list ('[12345]')
63>>> split_list ('[123,[45,67],(89,[10,11],12),13]')
64['123', '[45,67]', '(89,[10,11],12)', '13']
66 return split_list1 (l[1:-1],
',')
69if __name__ ==
'__main__':
70 from PyUtils
import coverage