The Fisrt Updated
This commit is contained in:
14
text.py
Normal file
14
text.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import re
|
||||
import shlex
|
||||
|
||||
def GetRulesConvertedToJson2(s):
|
||||
result = {}
|
||||
key, values = re.match(r'(\w+)\s(.+)', s).groups()
|
||||
lexer = shlex.shlex(values, posix=True)
|
||||
lexer.whitespace += ','
|
||||
lexer.whitespace_split = True
|
||||
lexer.quotes = "'"
|
||||
result[key] = list(lexer)
|
||||
return result
|
||||
|
||||
print(GetRulesConvertedToJson2("VEG 1,2,'123 23',5"))
|
||||
Reference in New Issue
Block a user