How to indent correctly multi-line list of arguments inside function call in Python


I want to create this multi-line function call. The examples that I find for nested constructs they assume that there is a character starting each line i Cannot find an example where a bracket [ is followed by a parenthesis ( without anything in between.

So how would I format this:['docker-compose', '-f', 'docker-compose.test.yml', '-f',
                   '', '-f', '', 'down'],

where should the bracket go? How should i format the list of arguments? Is it ok if I have multiple on the same line? Or should each argument has its own line


You can do something like this

import subprocess
        'docker-compose', '-f', 'docker-compose.test.yml', '-f',
        '', '-f', '', 'down'

Answered By – prnvbn

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published