How to wrap this line of Python script?

HI

trying to find a way to wrap this line of Python (see Script to find all ungrouped items for more background) , but neither the parenthesis way nor the \ seem to work:

caught = '!- {}\n\n*==== Entity count ====\n!- {} entities to list\n+- {} groups processed\n*==== Settings ====\n/- targetting group: {}\n$- ignoring {} domains: {}'.format(entity_ids,len(entity_ids),len(groups),target_group,len(domains_to_ignore), domains_to_ignore)

the \n's in the line themselves need to stay, they take care of the formatting of the output to:

45

what could I try?

Why do you need to wrap it?

because I want all code to be within the editors width.

regular code can be wrapped with \ or the parenthesis method but that doesn’t work in this line.

Have you tried it like this?

caught = '!- {}\n\n*==== Entity count ====\n'\
         '!- {} entities to list\n'\
         '+- {} groups processed\n'\
         '*==== Settings ====\n'\
         '/- targetting group: {}\n'\
         '$- ignoring {} domains: {}'\
         .format(entity_ids,
                 len(entity_ids),
                 len(groups),
                 target_group,
                 len(domains_to_ignore), 
                 domains_to_ignore)

Sebastian

No, but this definitely is what I was looking for, thanks you very much! very nice indeed.

slightly change code from before, in your formatting:

left_over_card = '*=========== Orphans ===========\n' \
                 '{} ' \
                 '*==========Entity count=========\n' \
                 '!- {} entities to list\n' \
                 '+- {} groups processed\n'\
                 '*=========== Settings ===========\n'\
                 '/- targetting group: {}\n'\
                 '$- ignoring {} domains: {}'\
                 .format(left_overs,
                         len(entity_ids),
                         len(groups),
                         target_group,
                         len(domains_to_ignore), 
                         domains_to_ignore)

showing fine now:

08