On Tue, Jun 27, 2017 at 11:55 PM, Didymus <lynt...@gmail.com> wrote: > Greetings, > > I might be barking up the wrong tree, but was wondering if there's a way to > have the argpasre epilog call a function. for example: > > epilog=Examples() > > Where Examples is: > > def Examples(): > text = """Lots of examples""" > print(text.format()) > > I've place this in and found that it prints out no matter if I use the -h or > not and also it prints first.... If I do: > > epilog='Single Example' > > it works as intended, unfortunately, I need to show several examples. Just > wondering if someone has found a why to do this (without making a custom > help).
The way you've written it, Examples() will be called before argparse does its work, and whatever it returns becomes the epilog. Can you work your function such that it returns a string, instead of printing something? Or is it a very expensive function? ChrisA -- https://mail.python.org/mailman/listinfo/python-list