S
Sullivan WxPyQtKinter
I do not know if there is any lib specially designed to process the
strings in scipt language.
for example:
I hope to process the string"print a,b,c,d,e "in the form"command
argumentlist" and return:
{'command'='print',
'argumentlist'=['a','b','c','d','e']}
Are there any lib to implement this?
Ideally , the lib should have a function like below:
def extract(commandstring, splitformat)
eg:
extract("see#you@tonight","what#whom@when")
return: {"what":"see","whom":"you","when":"tonight"}
extract("1;2;3;4;5","list[;]")
return: {"list":['1','2','3','4','5']}
extract("print a,b,c,d,e","command arglist[,]")
return: {"command":"print","arglist":['a','b','c','d','e']}
extract("fruit:apple~orgrange~pear~grape#name:tom;sam;dim;ham"
,"class1:instance1[~]#class2:instance2[;]")
return: {"class1":"fruit",
instance1:['apple','orange','pear','grape'],
"class2":"name",
"instance2":['tom','sam','dim','ham']
}
####### # # # #
# # # # #
# # # # #
# ####### #
# # # # #
# # # # #
# # # # #
strings in scipt language.
for example:
I hope to process the string"print a,b,c,d,e "in the form"command
argumentlist" and return:
{'command'='print',
'argumentlist'=['a','b','c','d','e']}
Are there any lib to implement this?
Ideally , the lib should have a function like below:
def extract(commandstring, splitformat)
eg:
extract("see#you@tonight","what#whom@when")
return: {"what":"see","whom":"you","when":"tonight"}
extract("1;2;3;4;5","list[;]")
return: {"list":['1','2','3','4','5']}
extract("print a,b,c,d,e","command arglist[,]")
return: {"command":"print","arglist":['a','b','c','d','e']}
extract("fruit:apple~orgrange~pear~grape#name:tom;sam;dim;ham"
,"class1:instance1[~]#class2:instance2[;]")
return: {"class1":"fruit",
instance1:['apple','orange','pear','grape'],
"class2":"name",
"instance2":['tom','sam','dim','ham']
}
####### # # # #
# # # # #
# # # # #
# ####### #
# # # # #
# # # # #
# # # # #