Home > Software design >  List to string with separators
List to string with separators

Time:02-14

I am trying to pass a command line arguments to AWS lambda as a event json. I have a list out of the command line args like:

['engine', '-e', '100', '-w', '4']

When I pass this list I want to it get passed as:

'engine', '-e', '100', '-w', '4'

I am trying to use it like this:

listcommd = ['engine', '-e', '100', '-w', '4']
command = ["--bucket", "mybucket", f"{listcommand}"]

I want the end result to look like:

command = ["--bucket", "mybucket", 'engine', '-e', '100', '-w', '4']

but it is looking like:

command = ["--bucket", "mybucket", "['engine', '-e', '100', '-w', '4']"]

CodePudding user response:

Lists support concatenation. Just do this:

command = ["--bucket", "mybucket"]   listcommand
  • Related