Sort argparse help alphabetically
问题 I am using Python's (2.7) argparse facility and would like to automatically sort the help it produces alphabetically by option. By default help entries are sorted in the order they are added*, as in: p = argparse.ArgumentParser(description='Load duration curves and other plots') p.add_argument('--first', '-f', type=int, default=1, help='First Hour') p.add_argument('--dur', '-d', type=int, default=-1, help='Duration in Hours. Use -1 for all') p.add_argument('--title', '-t', help='Plot Title