Skip to content

Instantly share code, notes, and snippets.

@hadret
Created June 23, 2019 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadret/798e01e0147f8fc146f4e40cddf3ffa5 to your computer and use it in GitHub Desktop.
Save hadret/798e01e0147f8fc146f4e40cddf3ffa5 to your computer and use it in GitHub Desktop.
Simple list transformation
# -*- coding: utf-8 -*-
things1 = ['one', 'two', 'three', 'four'] # list of things
things2 = ['-a ' + s for s in things1] # list comprehension
cmd = 'command that needs flags ' + ' '.join(s for s in things2)
print(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment