more parsers
This commit is contained in:
1 parent
951883c6c6
commit
e0aa9d4bb9
1 file changed
+2
-2
@@ -1,4 +1,4 @@
|
||||
def colon_separated_string_to_dict(string):
|
||||
def colon_separated_string_to_dict(string, separator=':'):
|
||||
'''
|
||||
Converts a string in the format:
|
||||
|
||||
@@ -20,7 +20,7 @@ def colon_separated_string_to_dict(string):
|
||||
dictionary = dict()
|
||||
|
||||
for line in string.splitlines():
|
||||
line_data = line.split(':')
|
||||
line_data = line.split(separator)
|
||||
|
||||
if len(line_data) > 1:
|
||||
dictionary[line_data[0].strip()] = ''.join(line_data[1:]).strip()
|
||||
|
||||
Reference in new issue
Block a user