Python String Argument Parsing -


i working cmd class in python , passes me of arguments 1 big string. best way tokenize arg string array of args[].

example:

args = 'arg arg1 "arg2 quotes" arg4 arg5=1' result = split_args(args) 

and like:

 result = [         'arg',       'arg1',       'arg2 quotes',       'arg4',       'arg5=1' ] 

import shlex shlex.split('arg arg1 "arg2 quotes" arg4 arg5=1') 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -