Skip to content Skip to sidebar Skip to footer

Python String Argument Parsing

I am working with the cmd class in python and it passes me all of my arguments as one big string. What is the best way to tokenize this arg string into an array of args[]. Example

Solution 1:

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

Post a Comment for "Python String Argument Parsing"