Commit da1d5bb6 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #485 from jdemeyer/parse_list

Fix parse_list("")
parents 38b79333 df470e8e
...@@ -122,6 +122,10 @@ def file_hash(filename): ...@@ -122,6 +122,10 @@ def file_hash(filename):
def parse_list(s): def parse_list(s):
""" """
>>> parse_list("")
[]
>>> parse_list("a")
['a']
>>> parse_list("a b c") >>> parse_list("a b c")
['a', 'b', 'c'] ['a', 'b', 'c']
>>> parse_list("[a, b, c]") >>> parse_list("[a, b, c]")
...@@ -131,7 +135,7 @@ def parse_list(s): ...@@ -131,7 +135,7 @@ def parse_list(s):
>>> parse_list('[a, ",a", "a,", ",", ]') >>> parse_list('[a, ",a", "a,", ",", ]')
['a', ',a', 'a,', ','] ['a', ',a', 'a,', ',']
""" """
if s[0] == '[' and s[-1] == ']': if len(s) >= 2 and s[0] == '[' and s[-1] == ']':
s = s[1:-1] s = s[1:-1]
delimiter = ',' delimiter = ','
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment