I have command line arguments in a string and I need to split it to feed to argparse.ArgumentParser.parse_args
.
I see that the documentation uses string.split()
plentifully. However in complex cases, this does not work, such as
--foo "spaces in brakets" --bar escaped spaces
Is there a functionality to do that in python?
(A similar question for java was asked here).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…