About 2,950,000 results
Open links in new tab
  1. What's the best way to parse command line arguments?

    What's the easiest, tersest, and most flexible method or library for parsing Python command line arguments?

  2. python - How to use argparse subparsers correctly? - Stack Overflow

    a_parser.add_argument("something", choices=['a1', 'a2']) Since -v is defined for the main parser, it must be specified before the argument that specifies which subparser is used for the remaining arguments.

  3. python - argparse mutual exclusive group - Stack Overflow

    What I need is: pro [-a xxx | [-b yyy -c zzz]] I tried this but it doesn't work: group= parser.add_argument_group('Model 2') group_ex = group.add_mutually_exclusive ...

  4. How can I parse (read) and use JSON in Python? - Stack Overflow

    My Python program receives JSON data, and I need to get bits of information out of it. How can I parse the data and use the result? I think I need to use json.loads for this task, but I can't under...

  5. python - How can I parse XML and get instances of a particular node ...

    Python has an interface to the expat XML parser. xml.parsers.expat It's a non-validating parser, so bad XML will not be caught. But if you know your file is correct, then this is pretty good, and you'll …

  6. How to handle variable number of arguments (nargs='*')

    The relevant Python bug is Issue 15112. argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional When argparse parses ['1', '2', '--spam', '8', '8', …

  7. How to parse multiple nested sub-commands using python argparse?

    import argparse ## This function takes the 'extra' attribute from global namespace and ## re-parses it to create separate namespaces for all other chained commands. def parse_extra (parser, namespace): …

  8. Which tool to use to parse programming languages in Python?

    Apr 12, 2017 · Which Python tool can you recommend to parse programming languages? It should allow for a readable representation of the language grammar inside the source. It should also be able to …

  9. Python argparse command line flags without arguments

    python command-line-arguments argparse asked Nov 24, 2011 at 14:57 interstar 27.5k 38 120 188

  10. python - How do I parse an ISO 8601-formatted date and time? - Stack ...

    Sep 24, 2008 · isoparse function from python-dateutil The python-dateutil package has dateutil.parser.isoparse to parse not only RFC 3339 datetime strings like the one in the question, but …