Python argparse : How can I get Namespace objects for argument groups separately? : <p>I have some command line arguments categorized in groups as follows:</p>

<pre><code>cmdParser = argparse.ArgumentParser()
cmdParser.add_argument('mainArg')

groupOne = cmdParser.add_argument_group('group one')
groupOne.add_argument('-optA')
groupOne.add_argument('-optB')

groupTwo = cmdParser.add_argument_group('group two')
groupTwo.add_argument('-optC')
groupTwo.add_argument('-optD')
</code></pre>

<p>How can I parse the above, such that I end up with three different Namespace objects?</p>

<pre><code>global_args - containing all the arguments not part of any group
groupOne_args - containing all the arguments in groupOne
groupTwo_args - containing all the arguments in groupTwo
</code></pre>

<p>Thank you!</p>
