Python: how to enclose strings in a list with < and >

Posted by Michael Konietzny on Stack Overflow See other posts from Stack Overflow or by Michael Konietzny
Published on 2010-04-12T15:32:50Z Indexed on 2010/04/12 15:43 UTC
Read the original article Hit count: 430

Hello,

i would like to enclose strings inside of list into <> (formatted like <%s>). The current code does the following:

def create_worker (general_logger, general_config):
    arguments = ["worker_name", "worker_module", "worker_class"]
    __check_arguments(arguments)

def __check_arguments(arguments):
    if len(sys.argv) < 2 + len(arguments):
        print "Usage: %s delete-project %s" % (__file__," ".join(arguments))
        sys.exit(10)

The current output looks like this:

Usage: ...\handler_scripts.py delete-project worker_name worker_module worker_class

and should look like this:

Usage: ...\handler_scripts.py delete-project <worker_name> <worker_module> <worker_class>

Is there any short way to do this ?

Greetings, Michael

© Stack Overflow or respective owner

Related posts about python

Related posts about string-manipulation