Created
June 23, 2019 07:11
-
-
Save hadret/798e01e0147f8fc146f4e40cddf3ffa5 to your computer and use it in GitHub Desktop.
Simple list transformation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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